Hi! I have some postcodes and I want to et the following information: city, province and region. I did the following query using Nominatim: To retrieve the city I found out that there can be varoius information in the addressdetails: loca.raw['address']['city'], loca.raw['address']['hamlet'], loca.raw['address']['village']. To retrieve the region I found out that the information is stored in loca.raw['address']['state']. For the province I have found the information under loca.raw['address']['county'], but it is not always correct. I'll make you an example: postcode 47122, it is a city in Italy, province Forlì. When I search this postcode in nominatim.openstreetmap I get this result: So my question is: Is this workflow correct or there are better ways to retrieve city, province and region? How can I get a more detailed address that includes all the information I need? Thanks, Carlotta. asked 01 Apr '20, 13:47 Carlotta |
Yes, that's the approach. In the response a place https://wiki.openstreetmap.org/w/index.php?title=Tag:boundary%3Dadministrative&uselang=en-US shows what admin_level numbers mean in the various countries. In Italy 6 it is provinces. answered 01 Apr '20, 14:02 mtmail Thanks a lot! So to have the province detail I need to specify boundary=administrative + admin_level=6 in the geocode? Thanks again, Carlotta.
(01 Apr '20, 14:16)
Carlotta
It's not clear which software library you use. Check its documentation or http://nominatim.org/release-docs/latest/api/Search/ for possible parameters/filters. To get the details about a province you'd need to search for the province name.
(01 Apr '20, 15:17)
mtmail
Sorry, I haven't specified that! I am using Geopy Nominatim in python. I tried to search for documentation on it, but I haven't found anything useful yet.
(01 Apr '20, 15:21)
Carlotta
|