No worries glad it was of use
On 14 Sep 2016, at 09:47, Dave Crozier DaveC@Flexipol.co.uk wrote:
Chris, With a few modifications unique to how I WANT IT TO FUNCTION THAT WORKED LIKE A DREAM
Thanks for the input!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Chris Davis Sent: 13 September 2016 16:33 To: profox@leafe.com Subject: RE: Google API for Geocoding ... Again
FUNCTION geocode LPARAMETERS lcpostcode
lcurl="http://maps.googleapis.com/maps/api/geocode/json?address=##ADDRESS##"
lojson=NEWOBJECT('json')
lctempurl=STRTRAN(lcurl,"##ADDRESS##",STRTRAN(ALLTRIM(lcpostcode)," ","")) lcget=httptostr(lctempurl) lcret="" loquery=lojson.decode(lcget) IF ALLTRIM(loquery.get("status"))="OK" loresult=loquery._results.get(1) logeo=loresult.get("geometry") loloc=logeo.get("location") lcret=ALLTRIM(TRANSFORM(loloc.get("lat")))+","+ALLTRIM(TRANSFORM(loloc.get("lng"))) endif
RELEASE lojson
RETURN lcret
Json code is from https://github.com/sait/vfpjson Httptostr is part of vfpconnection from sweet potato
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Dave Crozier Sent: 13 September 2016 16:26 To: profoxtech@leafe.com Subject: RE: Google API for Geocoding ... Again
Alan, Your solution worked like a dream, thanks. Just knocking it into a useable class now to allow input and output from our system within the daily constraints set by Google on free accounts.
Looks like I won't have to pull any more of my "minimalist" hair out tonight!!
Dave (& Tom)
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Alan Bourke Sent: 13 September 2016 16:15 To: profoxtech@leafe.com Subject: Re: Google API for Geocoding ... Again
Or you can just use the WinHTTP library in Windows as per the Gist I linked earlier, and get a string back straight into VFP. The hardest part of all this is going to be parsing the JSON to be honest.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]