Geocode of a Intersection of Two Roads

*爱你&永不变心* 提交于 2019-12-10 19:13:01

问题


Does anyone have a method or an API or a format that I can enter into the google maps API or any other API so I can get a latitude and longitude of an intersection reliably? For example if I enter "13th and Walnut, Philadelphia, PA" or "13th st and Walnut av, Philadelphia PA" (preferably the first one) the API reliably returns the latitude and longitude. Google maps API geocoding, when I do a http request, will occasionally get it right, but not often enough and without any pattern. Sometimes very similar requests will succeed the first time and then fail the second, with the API most often failing to find a location. I preferably would like an API with a free plan.


回答1:


I think Geocoding API is the best option for you. Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers on a map, or position the map.

If you want to access the Google Maps Geocoding API over HTTP, then you can follow the guidelines in the documentation link above.

https://maps.googleapis.com/maps/api/geocode/json?address=13th%20and%20Walnut,%20Philadelphia,%20PA

This request will return you a "lat" : 39.95043578029149 and "lng" : -75.1607739197085.

And if you want to know how to code it, then you can check the sample code here and this jsfiddle

For your question about FREE PLAN, Geocoding API is free up to 2,500 request per day. And if you reach this limit, it will charge you a $0.50 USD / 1,000 additional requests, up to 100,000 request daily.

For more information about Price details of Google MAPS API, check this link.



来源:https://stackoverflow.com/questions/38057498/geocode-of-a-intersection-of-two-roads

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