find latitude & longitude of saved marker in leaflet

I have circle marker

var myMarker = L.circleMarker(stuSplit, 
    { title: 'unselected' })
        .bindLabel("Name: " + students[i][j][0] 
                   + " ReachTime: " + students[i][j][2]);

Now I want to find latitude & Longitude this myMarker.

I was trying myMarker.getLatLng() but it is not working.



The problem does not lie in getLatLng(). This works fine:

var map ='map').setView([55.4411764, 11.7928708], 13);
L.tileLayer('http://{s}{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="">OpenStreetMap</a> contributors'

var stuSplit = L.latLng(55.4411764, 11.7928708);
var myMarker = L.circleMarker(stuSplit, 
    { title: 'unselected' })

See a working example here:


So you can

    var curPos = myMarker.getLatLng();
    alert(curPos.lng + " : " +;

this in more detail.

See a working example here.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.