如何确定经纬度坐标长上与谷歌地图API第2路 [英] How to determine if lat long coordinates are on a road with Google Maps API v2
问题描述
我已经使用谷歌的地理地址和使用经纬度/长已经得到了地址。我如何确定,如果我在路上呢?基本上,点击测试道路?我目前正在使用的位置经理纬度/经度和GeoAddress是相同的道路,毗邻的道路。
最终解决方案
使用反向通过谷歌地理编码API 的地理编码。
术语地理编码一般指翻译人类可读 地址到地图上的一个位置。做相反的过程, 平移地图上的一个位置到一个人类可读地址,是 被称为反向地理编码。
地理编码API支持直接使用经纬度反向地理编码 参数。例如,下面的查询包含 在布鲁克林的位置的纬度/经度值:
<$p$p><$c$c>http://maps.googleapis.com/maps/api/geo$c$c/json?latlng=40.714224,-73.961452&sensor=true_or_false
本文档介绍了如何跨preT JSON的结果,但StackOverflow上有不同的答案,解决更有效的方法来分析数据。
- <一个href="http://stackoverflow.com/a/8095967/1085891">http://stackoverflow.com/a/8095967/1085891
- <一个href="http://stackoverflow.com/a/8314094/1085891">http://stackoverflow.com/a/8314094/1085891
- <一个href="http://stackoverflow.com/a/6335080/1085891">http://stackoverflow.com/a/6335080/1085891
可能的解决方案
-
<一个href="http://stackoverflow.com/questions/18607180/getting-the-nearest-street-road-coordinates-in-android">Getting最近的街道/公路坐标机器人 - 在这个问题的答案可能你指出正确的方向。
您可以直接使用方向API:<一href="http://maps.googleapis.com/maps/api/directions/json?origin=51,19&destination=51,19&sensor=false">http://maps.googleapis.com/maps/api/directions/json?origin=51,19&destination=51,19&sensor=false
您可以使用API找到方向这将随后提供最接近的道路?
- 棒位置路上Android地图V2
- <一个href="http://www.$c$cproject.com/Articles/112044/GPSLocator-App-to-Find-Current-Nearest-Location-us">GPSLocator - 应用程序使用GPS 来找到当前(最近)地点 - 可能是有帮助的;不能肯定这一点。
- 捕捉到道路的Android - 完全一样的问题
快速搜索结果
- 捕捉到就近的街道
- 地图API博客使用<一个href="https://developers.google.com/maps/documentation/javascript/v2/reference?csw=1#GDirections">GDirections.loadFromWaypoints
- <一个href="http://stackoverflow.com/questions/6582479/finding-nearest-street-given-a-lat-long-location">Finding最近的街道给予LAT-长的位置
- <一个href="http://wptrafficanalyzer.in/blog/driving-route-from-my-location-to-destination-in-google-maps-android-api-v2/">Driving路线从我的位置在谷歌地图Android的API V2目的地
未解决类似的问题
- <一个href="http://stackoverflow.com/questions/17724649/trace-the-location-only-on-road-in-google-maps-v2-android">Trace只有在路在谷歌的位置地图V2的Android
- 谷歌地图V2捕捉到道问题
I have used Google geo address and using lat/long have got the address. How do I determine if I am on road on not? Basically hit-test for road? I am currently using location manager for lat/long and the GeoAddress is same for on road and next to road.
Final Solution
Use reverse geocoding via the Google Geocoding API.
The term geocoding generally refers to translating a human-readable address into a location on a map. The process of doing the converse, translating a location on the map into a human-readable address, is known as reverse geocoding.
The Geocoding API supports reverse geocoding directly using the latlng parameter. For example, the following query contains the latitude/longitude value for a location in Brooklyn:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false
The docs explain how to interpret the json results but StackOverflow has various answers addressing more efficient ways to parse the data.
- http://stackoverflow.com/a/8095967/1085891
- http://stackoverflow.com/a/8314094/1085891
- http://stackoverflow.com/a/6335080/1085891
Possible Solutions
Getting the nearest street/road coordinates in android - the answer to this question may point you in the right direction.
You can use directions api directly: http://maps.googleapis.com/maps/api/directions/json?origin=51,19&destination=51,19&sensor=false
Could you use the API to find directions which would then provide the closest road?
- Stick position to road on android maps v2
- GPSLocator - App to Find Current (Nearest) Location using GPS - possibly helpful; not so sure on this one.
- Snap to Roads Android - Exact same question
Quick Search Results
- Snap to nearest street
- Maps API Blog using GDirections.loadFromWaypoints
- Finding nearest street given a lat-long location
- Driving route from my location to destination in Google Maps Android API V2
Unsolved Similar Questions
这篇关于如何确定经纬度坐标长上与谷歌地图API第2路的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!