Make the service and call it as needed from your app.
var address = "123 something st, somewhere"; var requestUri = string.Format(" http://maps.googleapis.com/maps/api/geocode/xml?address=%7B0%7D&sensor=f...", Uri.EscapeDataString(address));
var request = WebRequest.Create(requestUri); var response = request.GetResponse(); var xdoc = XDocument.Load(response.GetResponseStream());
var result = xdoc.Element("GeocodeResponse").Element("result"); var locationElement = result.Element("geometry").Element("location"); var lat = locationElement.Element("lat"); var lng = locationElement.Element("lng");
make address your input param and output lat and lng.
On Tue, Sep 13, 2016 at 5:44 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Fellow Gentlemen, I posted a request about doing geocoding requests to receive back a Lat/Long dataset for various addresses a few weeks ago and now find that Google do in fact provide a Geocoding service:
https://developers.google.com/maps/documentation/geocoding/start
The responses back from the requests are all JSON from a Java Script API run by Google. I have looked over Rick's Westwind site to try and get a start on using this method to get back a JSON response but seem to be getting nowhere fast. Anyone got any ideas on a simple & neat way of retrieving this data back using VFP programmatically? Either that or anyone know a free Geocoding site that would handle up to 100 name and address calls per day ideally by sending a text file and receiving one back which could be automated from the VFP end.
Never even looked at Web services in anger before so it all seems a little baffling and terribly long winded at the moment unless I am missing something obvious.
Note I don't want to have to drop into an intermediate program/language to accomplish this, if possible.
Dave
[excessive quoting removed by server]