Hi
Is there any updated documentation for mapping multiple gps points from database to the google map component?
Thanks
Hi
Is there any updated documentation for mapping multiple gps points from database to the google map component?
Thanks
Hello Deon,
We don't have it. What mapping exactly do you use and what exactly does not work?
Hi
I found a post that provided the code for mapping multiple GPS locations...
This is basically the code required in the success event of the mapping.
var list_location = Apperyio.storage.markerList.get();
var coordsArray = list_location;
var marker;
var image = '../img/beacon24.png';
var map = new Appery("Gmap").options.mapElement.gmap('get', 'map');
var CreateMarker = function(coordsArray, i){
var marker = new google.maps.Marker({
position: new google.maps.LatLng( coordsArray.lat, coordsArray.lng),
title: coordsArray.friendlyName,
map: Appery("Gmap").gmap,
icon: image,
});
var infowindow = new google.maps.InfoWindow({content: coordsArray.friendlyName});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(Appery("mapMark").gmap,marker);
});
};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);
To go on further to this point. How do I clear the markers on the map. Surely there must be a simple Appery("map"). refresh(); ????
Deon,
I am duplicating the solution you were provided in the related Zendesk ticket (and satisfied with) so that the Appery.io community could also use the "delete" code.
code
//Get markers from global variable.
coordsArray = self.markersArray;
var map = new Appery("Gmap").options.mapElement.gmap('get', 'map');
for (var i = 0, j = coordsArray.length; i < j; i++) {
coordsArray.setMap(null);
};
self.markersArray = [];
/code
Also, here is a modified code to show all markers on the screen: https://getsatisfaction.com/apperyio/...