leaflet - Leafet e.target.getLatLng() not working when paired with markercluster -


i'm using leafet (django-leaflet more precise) , i've been able form .on(click) on marker pans marker , zooms in zoom 10. done using map.setview(e.target.getlatlng(),10);

however, have implemented leaflet markercluster , seems getlatlng() undefined function now?

code without markercluster, works perfectly:

function oneachfeature(feature, layer) {              layer.bindpopup(feature.properties.name).on('click', clickzoomy);              function clickzoomy(e) {               if (map.getzoom() < 10){                 map.setview(e.target.getlatlng(),10) //zoom               } else{                 map.setview(e.target.getlatlng())               }}; 

here code i'm using markercluster:

var multimarker = new l.markerclustergroup();  multimarker.addlayer(l.marker([52.526013, 13.398351],{icon: markhospital})).on('click', clickzoom); multimarker.addlayer(l.marker([52.513666, 13.389633],{icon: markhospital})).on('click', clickzoom); multimarker.addlayer(l.marker([52.512842, 13.389277],{icon: markhospital})).on('click', clickzoom);  map.addlayer(multimarker);  function clickzoom(e) {     map.setview(e.target.getlatlng(),10)}; 

i had parenthesis in wrong place.

multimarker.addlayer(l.marker([52.526013, 13.398351],{icon: markhospital})).on('click', clickzoom); 

had changed to

multimarker.addlayer(l.marker([52.526013, 13.398351],{icon: markhospital}).on('click', clickzoom)); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -