Created
October 27, 2019 16:38
-
-
Save oeon/77cc510e6db7e0350f5d992f229f6832 to your computer and use it in GitHub Desktop.
Using Fulcrum Data Events for routing with Google Maps and MAPS.ME
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ON('change', 'routing_options', () => { | |
if ($routing_options == 'google') { | |
if (LATITUDE() && LONGITUDE()) { | |
OPENURL('https://maps.google.com/?q=' + LATITUDE() + ',' + LONGITUDE()); | |
} else { | |
ALERT('No location provided!', 'A location is required to show Google Maps.') | |
} | |
SETVALUE('routing_options', null); | |
} else if ($routing_options == 'mapsme') { | |
let location = CURRENTLOCATION(); | |
if (!location) { | |
// location could not be determined. | |
} else { | |
lat = location.latitude; | |
lng = location.longitude; | |
if (LATITUDE() && LONGITUDE() && lat && lng) { | |
// example maps.me URL scheme/intent | |
// mapsme://route?sll=55.7522,37.6155&saddr=Destination&dll=55.763,37.6155&daddr=Destionation&type=pedestrian | |
OPENURL('mapsme://route?sll=' + lat + ',' + lng + '&saddr=Start&dll=' + LATITUDE() + ',' + LONGITUDE() + '&daddr=Destination&type=vehicle'); | |
} else { | |
ALERT('No location provided!', 'A location is required to show MAPS.ME.') | |
} | |
SETVALUE('routing_options', null); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment