Leaflet Multiple Marker

Posting sebelumnya bagaimana membuat marker dengan contoh satu marker atau penanda. Selanjutnya bagaimana cara membuat multiple marker di leaflet. berikut contoh kodenya.

function main() {

var options = {
center: [0.5769167874644966, 123.01858018012717],
zoom: 15
}

var map = L.map('map', options);

L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
{attribution: 'CARTO'})
.addTo(map);

// add multiple marker
L.marker([0.5769167874644966, 123.01858018012717]).addTo(map);
L.marker([0.57415, 123.02233]).addTo(map);
}
window.onload = main;

Hasil display dari kode diatas adalah dibawah.

leaflet-library-css-js-3

Semoga bermanfaat, wassalam.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s