Google Map V3 Postal Code not returned

最后都变了- 提交于 2019-12-02 10:26:56

问题


I have a problem with google geocoding result

I'm geocoding French Cities and want to get their Postal Code

My problem is Google response with all the data EXCEPT the postal code

For example for Achère City, i get the address_components results :

[
Object { long_name="Cachan", short_name="Cachan", types=[2]}, 
Object { long_name="Val-de-Marne", short_name="94", types=[2]}, 
Object { long_name="Île-de-France", short_name="IDF", types=[2]}, 
Object { long_name="France", short_name="FR", types=[2]}
] 

So i get the city name, the "States" name and number and the country name

All the results are "Good" except no response for postal code returned

My problem is ... I only need the postal code :(

I searched on SO and Google docs ( a real jungle, most of their reference data are really not well doccumented ( when it is documented or up to date for V3 ) ) ...

1st Edit : And just found it's not the only problem ... An other French City give me this returned response :

[
Object { long_name="Angers", short_name="Angers", types=[2]}, 
Object { long_name="Maine-et-Loire", short_name="Maine-et-Loire", types=[2]}, 
Object { long_name="Pays de la Loire", short_name="Pays de la Loire", types=[2]}, 
Object { long_name="France", short_name="FR", types=[2]}
]

As i can't get the Postal code ( returned only when google is in a good day ) i'm using the 2 digits French State returned

For the first city it return :

Object { long_name="Val-de-Marne", short_name="94", types=[2]}, 

For the second city, the same line is

Object { long_name="Maine-et-Loire", short_name="Maine-et-Loire", types=[2]}, 

The value i need is the "94" as given for the 1st city, but not returned by the second city ...

Is there really no possibility to get every data details for every geocoding and for example get some blank when google don't have the data

Because in the present case, it is hard to make a rule working for every returned result ...

Thanks in advance, i'm totally lost with it

2nd Edit : Seems google return the postal code ... when it wants, i get it for 1 city every ... 10 or 15 cities ( not a problem of localisation as google find adresse, lat, lng etc for EVERY cities i try, just have the problem with the postal code )

来源:https://stackoverflow.com/questions/20490851/google-map-v3-postal-code-not-returned

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!