Page 1 of 1

JQM Tutorial for Mapping multiple location points to Google map

Posted: Mon Oct 15, 2018 8:36 am
by Deon

Hi

Is there any updated documentation for mapping multiple gps points from database to the google map component?

Thanks


JQM Tutorial for Mapping multiple location points to Google map

Posted: Tue Oct 16, 2018 5:38 am
by Serhii Kulibaba

Hello Deon,

We don't have it. What mapping exactly do you use and what exactly does not work?


JQM Tutorial for Mapping multiple location points to Google map

Posted: Thu Oct 18, 2018 11:54 am
by Deon

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);


JQM Tutorial for Mapping multiple location points to Google map

Posted: Tue Oct 23, 2018 7:41 am
by Deon

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(); ????


JQM Tutorial for Mapping multiple location points to Google map

Posted: Sun Oct 28, 2018 1:36 pm
by Galyna Abramovych

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
&#47;&#47;Get markers from global variable&#46;
coordsArray = self&#46;markersArray;

var map = new Appery("Gmap")&#46;options&#46;mapElement&#46;gmap('get', 'map');

for (var i = 0, j = coordsArray&#46;length; i < j; i++) {
coordsArray&#46;setMap(null);
};

self&#46;markersArray = [];
/code


JQM Tutorial for Mapping multiple location points to Google map

Posted: Thu Nov 01, 2018 6:49 am
by Deon

Thank you


JQM Tutorial for Mapping multiple location points to Google map

Posted: Thu Nov 08, 2018 10:08 am
by Serhii Kulibaba

Also, here is a modified code to show all markers on the screen: https://getsatisfaction.com/apperyio/...