I want to build a site similar to foursquare. I know with JavaScript on a iPhone i can get the GPS Cord and pass it to Php. I know i would need a database or api with the latitude and longitude with the address linked to it. Can i buy a database or any good api's to get this data? Never messed with Location data before but wrote other web apps before.
Answer by Ratchetr
Google is your friend ;-)
Look at the page returned by this URL:
http://maps.google.com/maps/api/geocode/xml?latlng=37.4219720,-122.0841430&sensor=false
You should be able to do an HTTP request from your PHP to Google, then parse the XML (Or you can get the result in JSON, if that's easier). Or, skip your PHP back end altogether, and just do the lookup from Javascript in your app directly to Google. If your PHP code has nothing to add to the result, there's no reason for the extra trip to your server.
If latlng is coming from a GPS, you should probably set sensor=true...although I still haven't figured out why that one matters.
Also, read the terms of service, yada yada (second link). I doubt they are strictly enforced, but try to stick to them.
What do you think? Answer below!
Orignal From: How would i turn a GPS cord into a address with Php and Mysql?
No comments:
Post a Comment