How to get road name or street name from GPS coordinates?

家住魔仙堡 提交于 2019-12-13 09:36:04

问题


Is there any possibility to get road name or street name when the GPS coordinates are given? I am developing an android application to provide upcoming road accident information to road users who are driving towards the accident situation. Therefore, I need to identify road users who are driving on the same route where the accident is. Hence, I will get the current position of the road user in every 500m. So I need to map this GPS positions with the road address and check whether the road user driving towards the incident. Please let me know if there is any possible method to do that. I am a beginner to maps.


回答1:


Your best bet would probably be to use an API that already exists, such as Google's Reverse Geocoding one.

It returns fairly promising data, an example (from the docs) being:

results[0].formatted_address: "277 Bedford Ave, Brooklyn, NY 11211, USA"
results[1].formatted_address: "Grand St/Bedford Av, Brooklyn, NY 11211, USA"
results[2].formatted_address: "Williamsburg, Brooklyn, NY, USA"
results[3].formatted_address: "Brooklyn, NY, USA"
results[4].formatted_address: "New York, NY, USA"
results[5].formatted_address: "Brooklyn, NY 11211, USA"
results[6].formatted_address: "Kings County, NY, USA"
results[7].formatted_address: "New York-Northern New Jersey-Long Island, NY-NJ-PA, USA"
results[8].formatted_address: "New York Metropolitan Area, USA"
results[9].formatted_address: "New York, USA"

Otherwise, writing your own implementation for this would be pretty non-trivial (but maybe very interesting).



来源:https://stackoverflow.com/questions/51941421/how-to-get-road-name-or-street-name-from-gps-coordinates

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