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 » Thu Aug 25, 2011 6:14 pm

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
Location: Bordeaux, France

Re: google maps API

Post by Dixie » Thu Aug 25, 2011 11:18 pm

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 » Fri Aug 26, 2011 6:05 am

Hi Dixie,

get the mileage..

Thanks!

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: google maps API

Post by Dixie » Fri Aug 26, 2011 7:23 am

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 419 times

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

Re: google maps API

Post by jmjared » Fri Aug 26, 2011 3:40 pm

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 » Mon May 21, 2018 3:36 am

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: 135
Joined: Mon Jul 31, 2006 1:39 am
Location: New Zealand, Australia, Germany, Japan
Contact:

Re: google maps API

Post by strongbow » Mon May 21, 2018 6:19 am

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 » Mon May 21, 2018 11:16 am

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: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: google maps API

Post by simon.schvartzman » Wed Jun 13, 2018 10:50 pm

@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 6857 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 ";" or not to ";" that is the question

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Mon Jul 31, 2006 1:39 am
Location: New Zealand, Australia, Germany, Japan
Contact:

Re: google maps API

Post by strongbow » Thu Jun 14, 2018 3:40 am

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

Return to “iOS Deployment”