-2

I have a js file formatted like this:

var database = [{
lat: 44.4405372,
lng: 11.4743532,
data: {
    code: 231671,
    dataora: '07/02/2019 - 18.30',
    agente: 'Jhon DOe',
    gif: 2
}
}, {
lat: 40.9171172,
lng: 14.7844072,
data: {
    code: 269531,
    dataora: '09/02/2010 - 18.30',
    agente: 'Miss Miss',
    gif: 1
}
}, 

and so on.

What I would like to obtain is a series of markers with:

  • every marker's icon is the 'gif' value +'.gif' (in a folder i've already created all the gifs)
  • if the user click che marker the infowindow shows a string composed by code + dataora + agente

I have tried a lot with gmap3 without success. Someone can point me to the right direction?

Thanks

Lanny
  • 73
  • 1
  • 1
  • 7

1 Answers1

2

Try something like this:

for(m in database) {
    var marker = new google.maps.Marker({
        position: new google.maps.LatLng(m.lat, m.lng),
        map: map // make sure you have created your map using the default js code
            image = new google.maps.MarkerImage(m.data.gif+'.gif');
    });
}

I haven't tested this but should get you close!

Terry Kernan
  • 746
  • 5
  • 12