2

I am currently having slight problem on displaying marker in the leaflet. I have used the following codes on displaying marker and map, however the map is displaying flawlessly but the marker is invisible. I have also tried worldCopyJump true but no help.

var map = new L.Map('map', {
    center: [0, 0],
    zoom: 3,
    layers: [new    L.tileLayer('http://localhost:8080/1.0.0/osm/{z}/{x}/{y}.png',{tms: true})] 
});

var marker = L.marker([85.29009, 27.69545]).addTo(map);

//following also won't work
//var marker = L.marker([85.29009, 27.69545]);
//map.addLayer(marker);

1 Answer 1

2

Your code looks correct and the marker is visible, however, you will need to zoom out a little bit to see it since the marker you dropped is too close to the north pole (see image below):

enter image description here

I tested your on jsfiddle and I am able to see the marker by changing the default zoom level from 3 to 0.

1
  • Thank you very much for pointing it out. I just did not get that. BTW, I realized that the latlong that i supplied on the marker are altered i.e. I used latLng(Longitude, latititude) instead of latLng(latitude, longitude). And now, here it showing up in right location after altering the lat long value. Thank you very much for your help!!!
    – Ra Ka
    Sep 11, 2015 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.