I found a sample stack online that I now have working that is showing perfectly a map on my screen with my current location. Here is the bulk of the code in that sample stack.
Code: Select all
on openCard
## MAP MergMK Stuff
if environment() = "mobile" then
/* So the screen does not go dim */
mobileLockIdleTimer
/* Start to get the location of your iphone/iPad */
mobileStartTrackingSensor "location", false
checkLocation
end if
if environment() = "mobile" then
send "createMap" to this card in 100 millisecs
end if
end openCard
on locationChanged latitude, longitude
/* keep the location in a custom prop */
set the theCurrentLocation of this stack to latitude & comma & longitude
end locationChanged
on checkLocation
/* Wait until the iPhone has got your latitude/Longitude */
repeat forever
wait 0 millisecs with messages
if the theCurrentLocation of this stack is not empty then
exit repeat
end if
end repeat
end checkLocation
on createMap
mergMKCreate
mergMKSet "rect", the rect of grc "map"
mergMKSet "center coordinate", the theCurrentLocation of this stack, true
mergMKSet "user tracking mode", "follow"
mergMKSet "shows user location", true
mergMKSet "zoom enabled",true
mergMKSet "scroll enabled",true
mergMKSet "map type", "standard"
mergMKSet "region", "150,150" ,false
mergMKSet "visible",true
end createMap
on closeCard
if environment() = "mobile" then
mobileLockIdleTimer
end if
if environment() = "mobile" then
mergMKDelete
end if
end closeCard
Within my app I know the lat & long of the users current location, I know the lat and long of 2 nearby locations.
I would like to display directions on this map to either 1 but preferably 2 locations.
I have been looking at
Code: Select all
mergMKGetDirections
Code: Select all
mergMKdirections
Any information that may help me become unstuck would be super appreciated.
Many Thanks