photon
photon copied to clipboard
Provide countryCode and stateCode in response
Today the json returned contain the country name and state name but not the codes.
It would be really nice to have the codes as well as a lot of services using addresses require them. This would also help for #175 as the user could simply postfilter the result for a given country.
This would be a great addition and would cover my issue completely! I tried looking into fixing it myself (even though my knowledge of Java is really limited), but it seems that the dataset in elasticsearch doesn't have the data either (correct me if I'm wrong), so I think the data needs to be added in the Nomatim import?
I guess we could do that ourselves, but then we can't profit from the ready to use search index provided by graphhopper.
Hello!
Any news about this? Is it possible to get the country code in some way?
Thank you very much, Vanessa
We love to receive pull requests :) !
Hehe, I would love to help but I probably won't find the time soon :P However, if it is useful to anyone, I found these libraries that might help:
https://pypi.python.org/pypi/pycountry https://github.com/tuneinc/pycountry-convert
I use them as:
import pycountry_convert country_name = result_raw['properties']['country'] country_code = pycountry_convert.country_name_to_country_alpha2(country_name, cn_name_format="default")
Cheers and thanks for your answer! Vanessa