Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

JQM Tutorial for Mapping multiple location points to Google map

Hi

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

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

JQM Tutorial for Mapping multiple location points to Google map

Hello Deon,

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

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

JQM Tutorial for Mapping multiple location points to Google map

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

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

JQM Tutorial for Mapping multiple location points to Google map

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

Galyna Abramovych
Site Admin
Posts: 84
Joined: Tue Mar 22, 2016 6:03 pm

JQM Tutorial for Mapping multiple location points to Google map

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

JQM Tutorial for Mapping multiple location points to Google map

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

Return to “Issues”