Page 1 of 1

Placing Multiple Markers on Google Map with Info Windows and preset Coordinates

Posted: Tue Jun 09, 2015 9:18 pm
by Drew Kelly

I'm building a map component of a larger app I've used the following tutorial: https://devcenter.appery.io/tutorials...

Which has been very helpful. I've augmented both my database and my Javascript to present the markers with more information. I'd also like to manually set the coordinates in the DB as well, and simply pass those variables along. ideally I'd eleminate the convertAdress portion. The API is good, but sometimes it place a wonky marker not where it needs to be, and it's crucial that never happen.

I'd assume there is a way to save the DB list service results to local storage. but I can't seem to make it work. Currently I've mapped the responses to the propper local storage then I am using the following JS:
for (var i = 0; i < data.length; i++)
{
var scPhone = localStorage.getItem('markerPhn');
var scName = localStorage.getItem('markerName');
var scLocation = localStorage.getItem('markerLoc');

var scContentString = ''+scName+'
'+scLocation+'
a rel="nofollow"'+scPhone+'/a';

var scInfowindow = new google.maps.InfoWindow({
content: scContentString
});
var scLatlng = new google.maps.LatLng(localStorage.getItem('markerLat'),localStorage.getItem('markerLng'));
var scMarker = new google.maps.Marker({
position: scLatlng,
map: map,
animation: google.maps.Animation.DROP,
title: scName,
});
google.maps.event.addListener(scMarker, 'click', function() {
scInfowindow.open(map,scMarker);
});
}
bounds.extend(scLatlng);
map.fitBounds(bounds);

any advice would be greatly appreciated.


Placing Multiple Markers on Google Map with Info Windows and preset Coordinates

Posted: Wed Jun 10, 2015 9:57 am
by Serhii Kulibaba