google maps API

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmjared
Posts: 10
Joined: Thu Mar 24, 2011 5:20 am

google maps API

Post by jmjared »

Hello,

I'm trying to get the Distance matrix API from google to work with iOS... it responds with a JSON output and an XML output. any of these two supported by livecode?

been trying to get the data to display on a field or image area but it doesn't work.

any suggestions would be appreciated

Thanks!
Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: google maps API

Post by Dixie »

Hi..

What do you want to do... get the mileage, plot the route between two points, get the text directions ?

be well

Dixie
jmjared
Posts: 10
Joined: Thu Mar 24, 2011 5:20 am

Re: google maps API

Post by jmjared »

Hi Dixie,

get the mileage..

Thanks!
Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: google maps API

Post by Dixie »

Hi...

I have attached a stack that will get the mileage for you... The script is in the button 'Locate'.
Hope it helps..

be well

Dixie
Attachments
mapStuff.zip
(2.26 KiB) Downloaded 785 times
jmjared
Posts: 10
Joined: Thu Mar 24, 2011 5:20 am

Re: google maps API

Post by jmjared »

wow! thanks a lot! this is exactly what I was looking for..
aamuelchua
Posts: 2
Joined: Mon May 21, 2018 3:30 am

Re: google maps API

Post by aamuelchua »

For the mapStuff, can you give me an exact example? I could not seem to get the reply as LiveCode throws back an error. I tried Singapore,SGP and Tokyo,JPN
strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 151
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: google maps API

Post by strongbow »

The Google Maps APIs have surely changed since this example was done. I just tried it and it does get a correct response but the parsing of the returned data is no longer ok. You can easily step through the script, see the variables and determine what's wrong - and fix it hopefully!

Have fun! :-)
aamuelchua
Posts: 2
Joined: Mon May 21, 2018 3:30 am

Re: google maps API

Post by aamuelchua »

I wanted to gather the distance travelled by Air. I tried Singapore and Malaysia as it is possible to drive between these two countries. However when I tried Singapore to Japan, I could not receive any reading. Could someone please help me?
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: google maps API

Post by simon.schvartzman »

@strongbow can you please share the input data (start and stop contents) you used to make it work?

With the following inputs it doesn't work for me
pic1.jpeg
pic1.jpeg (28.62 KiB) Viewed 11895 times
I get the following error:

Code: Select all

executing at 6:45:04 PM
Type	Operators *: error in left operand
Object	Locate
Line	put  (theMiles && "km" && "," && (theMiles * 0.62137119) && "mi") into tTemp
Hint	mouseUp
Many thanks in advance
Simon
________________________________________
To "AI", or not to "AI", that is the question
strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 151
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: google maps API

Post by strongbow »

Try putting a breakpoint at the line:

put URL tURL into red

and then have a look at the var red. It should show you the response from google maps with details etc. That's assuming it recognised your inputs ok. I tried it with

Sydney,Australia
Melbourne, Australia

Have fun! :-)
Post Reply