On Feb 2, 9:11 am, ALD2355 <[email protected]> wrote: > I have been using the geocoder to get addresses. This code extracts the UK > postcode when it is in the OX3 4 but not when a full postcode is available > e.g. OX3 3NU. Is there any reason for this? In the latter case it defaults > to the full address with the code below.
OX3 3NU doesn't return an address, which isn't surprising because it's not a valid postcode. The geocoder does its best with an invalid postcode, normally truncating the unit code (the last two letters) and using the sector (eg OX3 3), returning its centroid. If OX3 3 is invalid, because that sector isn't used, then it will go back to the district (OX3). A valid postcode like BN22 8RE retrieves a PostalCodeNumber of "BN22 8RE" and an address of "Eastbourne, East Sussex BN22 8RE, UK" together with a location, [ 0.3031330, 50.7838491, 0 ], which I guess is the Royal Mail/Ordnance Survey Code-Point location approximating to the centroid of the range of addresses for that postcode. What I do then is to reverse geocode that location to get an approximate street address range if possible. I don't know where the address-range data comes from. What the geocoder will never do is query the Royal Mail PAF® to get the *exact* range of addresses for a postcode. That data costs a lot of money. -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
