开发者

Converting address from database to lat/lng json

开发者 https://www.devze.com 2023-01-07 03:25 出处:网络
I have a database with addresses in which need to be converted to geocode to work with Google Maps API, i was thinking of bringing in the entries via JSON.

I have a database with addresses in which need to be converted to geocode to work with Google Maps API, i was thinking of bringing in the entries via JSON. Is there an easy way to get the addresses from the database convert them to geocode and create and JSON feed?

There are about 4000-5000 entires.

I know G开发者_StackOverflowoogle offer the Geocoding API, is there a way to intergrate this?


You probably want to write some server side code that runs through your database entries making GeoCoding HTTP requests for each address and then storing the lat/lng responses you get back from Google. You can run this process once (and probably throttle the GeoCoding requests so you don't hit request limits) because it is unlikely the lat/lngs associated with your address will change.

Once the lat/lngs are stored in your database (for each of your address entries) you can just return the location in your JSON.

0

精彩评论

暂无评论...
验证码 换一张
取 消