I'm fiddling with the maps v3 API and I'm using some examples from the web to try and get some differing markers. I can't seem to figure out why it's not working. I'm going for a similar map as this one - the idea is to filter out community members by the game they play/own......
http://googlemaps.googlermania.com/google_maps_api_v3/en/map_example_sidebar2.html
So I've created my array very similar with just two entries:
var stationList = [
{"latlng":[231.015,126.431],name:"membername1", battlefield4 : 1, warframe : 1, Ghosts : 1, Killzone: 0},
{"latlng":[234.004,134.999],name:"membername2", battlefield4 : 1, warframe : 1, Ghosts : 1, Killzone: 1},
];
And the block code I'm editing is:
var bounds = new google.maps.LatLngBounds();
var station, latlng;
var image = './img/member.png'
for ( i = 0; i < stationList.length; i++) {
station = stationList[i];
latlng = new google.maps.LatLng(station.latlng[0], station.latlng[1]);
bounds.extend(latlng);
var marker = createMarker({
map : mapCanvas,
position : latlng,
others : station,
icon: image
});
At the moment this assigns a default icon to everyone and works well, but there are roles within the community that I'd like to represent differently. What I did was add an entry to the array as follows:
var stationList = [
{"latlng":[51.515,-0.101],name:"membername1", battlefield4 : 1, warframe : 1, Ghosts : 1, Killzone: 0, image: "./img/founder.png"},
{"latlng":[51.678,-0.205],name:"membername2", battlefield4 : 1, warframe : 1, Ghosts : 1, Killzone: 1, image: "./img/founder.png"},
];
And then edited the marker block as follows:
var bounds = new google.maps.LatLngBounds();
var station, latlng;
var image;
for ( i = 0; i < stationList.length; i++) {
station = stationList[i];
latlng = new google.maps.LatLng(station.latlng[0], station.latlng[1]);
bounds.extend(latlng);
image = station.image;
var marker = createMarker({
map : mapCanvas,
position : latlng,
others : station,
icon: image
});
But it just seems to bomb the whole page out. I figure I'm not addressing the array properly or it's something to do with quotation marks etc. Any tips?
Thanks