Peter, Thanks for this...
regards, John Dixon > From: pmb...@gmail.com > To: use-livecode@lists.runrev.com > Subject: Re: LiveCode & google maps... > Date: Tue, 15 Feb 2011 10:56:56 -0500 > Here is a function I have used to fetch the total distance between two > addresses from Google maps. The function returns the distance without > displaying any map, but you could play with the script to also display > the map. > > -------- > > function getMileage > put "http://maps.googleapis.com/maps/api/directions/xml?" & \ > "origin=<tOrig>&destination=<tDest>&sensor=false" into tURL > put fld "from" into tStart > put fld "to" into tEnd > replace "<tOrig>" with urlEncode(tStart) in tURL > replace "<tDest>" with urlEncode(tEnd) in tURL > put URL tURL into t > put lineoffsets("<distance>",t) into startSect > put item -1 of startSect into startSect > put lineoffsets("</distance>",t) into endSect > put item -1 of endSect into endSect > if startSect = 0 or endSect = 0 then > beep > exit to top > end if > put line startSect+1 to endSect-1 of t into tSect > put lineoffset("<text>",tSect) into dLine > if dLine = 0 then > beep > exit to top > end if > put sr(line startSect + dLine of t) into tMiles > -- <text>3.6 mi</text> > replace "<text>" with empty in tMiles > delete word -1 of tMiles > return tMiles > end getMileage > > -- Peter > > Peter M. Brigham > pmb...@gmail.com > http://home.comcast.net/~pmbrig _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode