Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// HERE HQ in Berlin, Germany:
var HEREHQcoordinates = {
lat: 52.530974,
lng: 13.384944
};
var routeRendered = false;
function updatePosition (event) {
var coordinates = {
lat: event.coords.latitude,
lng: event.coords.longitude
};
var marker = new H.map.Marker(coordinates);
map.addObject(marker);
// If the route has not been rendered yet,
// calculate and render it
if (!routeRendered) {
var route = new HERERoute(map, platform, {
mode: 'fastest;car',
representation: 'display',
waypoint0: locationToWaypointString(coordinates),
waypoint1: locationToWaypointString(HEREHQcoordinates)
});
routeRendered = true;
}
}
navigator.geolocation.watchPosition(updatePosition);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.