问题
Putting it simply, we have some Norwegian postcodes and are using the API to get their addresses and lat & long. Nothing to highbrow, but on around 10% of the postcodes. The API returns no results, here's an example:
Success for postal_code=1151
:
http://maps.googleapis.com/maps/api/geocode/json?components=country:NO%7Cpostal_code:1151&sensor=false
Fail for postal_code=2066
:
http://maps.googleapis.com/maps/api/geocode/json?components=country:NO%7Cpostal_code:2066&sensor=false
I have noticed that the majority appear to be for the Postboks (presuming equivalent of PO boxes in the UK).
However, it's not true for all of them.
Has anyone similar experience and or perhaps a better knowledge of Norwegian postcodes?
Thanks
回答1:
I tried your given request, and I found that postal_code=2066
give you ZERO_RESULTS, If you are looking to the name Jessheim, am I right? Then I think you should use the postal_code=2069
, this will give you the request that you want.
Here is the request that I used.
maps.googleapis.com/maps/api/geocode/json?components=country:NO|postal_code:2069&sensor=false
Also, I think you should know first the correct/available postal code that you used. I tried to request generally in which I did not set any country as a filter.
First, I used the postal_code=1151
, and as you can see, you will find the 1151 Oslo, Norway address in the result. Which means the postal_code 1151
is available in Norway.
maps.googleapis.com/maps/api/geocode/json?components=country:|postal_code:1151
Second, I used the postal_code=2066
, and you will not find any address that the country is NORWAY.
maps.googleapis.com/maps/api/geocode/json?components=country:|postal_code:2066
For additional note, if you use two components value in your request. You need to use pipe(|) to separate them. I hope I help you with this :)
回答2:
KENDi - thanks a lot for your help and answer. I found out that Norway has two types of postcode. One is for the street addresses, the other is for postboxes (or PO Boxes in the UK) that don't have an geographical address.
Here's an example
http://adressesok.posten.no/en/postal_codes/search?utf8=%E2%9C%93&q=Molde
来源:https://stackoverflow.com/questions/38242043/google-maps-norwegian-postcodes-not-returning-any-results