如何从GPS坐标中获取道路名称或街道名称? [英] How to get road name or street name from GPS coordinates?

查看:861
本文介绍了如何从GPS坐标中获取道路名称或街道名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出GPS坐标后,是否有可能获得道路名称或街道名称?我正在开发一个android应用程序,以向即将发生事故情况的道路使用者提供即将发生的道路事故信息.因此,我需要确定在事故发生的同一条路线上行驶的道路使用者.因此,我将获得每500m中道路使用者的当前位置.因此,我需要将此GPS位置与道路地址对应起来,并检查道路使用者是否朝着该事件行驶. 请让我知道是否有任何可行的方法可以做到这一点.我是地图的初学者.

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.

推荐答案

您最好的选择可能是使用一个已经存在的API,例如Google的

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

这篇关于如何从GPS坐标中获取道路名称或街道名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆