Show points and routes with Google Maps in iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Show points and routes with Google Maps in iOS

Post by JosepM » Fri Mar 25, 2011 10:39 pm

Hi,

Any experiences about how in iOS show routes and points into a Google Map?
Attach some images to show what I trying.

Also I guess that using the GPS location, center a map and show points of interest or marks. Using the GoogleMap kit I be able of center a map into a stack but with iOS I can't.

Thanks in advance.

Salut,
JosepM
Attachments
Imagen 942.png
Zoom out with the route in green
Imagen 942.png (122.53 KiB) Viewed 5379 times
Imagen 943.png
Zoom in
Imagen 943.png (51.79 KiB) Viewed 5379 times

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Show points and routes with Google Maps in iOS

Post by JosepM » Sat Mar 26, 2011 8:53 am

I found that with the Google Maps API V3 I can show that I need.

iphoneControlDo id, "load", baseUrl, htmlText
Loads as page consisting of the given htmlText with the given baseUrl (wraps the loadHtmlString method of UIWebView).

Locally I can read from my database the stored marks and prepare the HTML, then load into the Browser.

In htmlText I put my HTML code, and the URL in baseURL.

But now how can I handle the click over a mark into the map to go to one card of the stack? Any idea if is posible?

Salut,
Josep

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Show points and routes with Google Maps in iOS

Post by BvG » Sat Mar 26, 2011 12:59 pm

it's probably something with "iphoneControlGet". I'm not doing iOS dev, so can't say what parameter it'd be, sorry.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

landoke
Posts: 10
Joined: Tue Jan 11, 2011 10:40 pm

Re: Show points and routes with Google Maps in iOS

Post by landoke » Sun Mar 27, 2011 4:25 am

The way I've done work with a web view in iOS before and interacting back with the code is by catching the "browserLoadRequest".

(You also need to make sure to set: iphoneControlSet sBrowserId, "delayRequests", "true")

This way you can, say, create a fake URL that you access that has some unique identifying feature about it which you can then parse and intercept. For example, in the code, create a link associated with the pin that goes to http : / / example . com/?myUniqueCode=43.28271,-71.72532

Then, in LiveCode card script:

Code: Select all

on browserLoadRequest pUrl, pReason
    if pUrl contains "?myUniqueCode=" then
        put char offset("?myUniqueCode=",14) to -1 of pUrl into pCode
        -- Do something with pCode
    else
        pass browserLoadRequest
    end if
end browserLoadRequest

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Show points and routes with Google Maps in iOS

Post by JosepM » Sun Mar 27, 2011 9:55 pm

Hi,

Many thanks, is just that I need. So in this way you can trap each load request before this will be completed, from the marks or whatever, isn't?

Salut,
Josep

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Show points and routes with Google Maps in iOS

Post by FireWorx » Thu Sep 22, 2011 8:45 pm

Great post thanks!

Post Reply