How to get road name or street name from GPS coord

2019-09-20 00:25发布

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条回答
We Are One
2楼-- · 2019-09-20 00:47

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).

查看更多
登录 后发表回答