Wednesday, 15 April 2015

javascript - marker symbols for leaflet_Ajax, looking always for default marker in js/images/marker-icon.png -



javascript - marker symbols for leaflet_Ajax, looking always for default marker in js/images/marker-icon.png -

i new leaflet have developed interactive maps in past. started working on displaying gps device on uav. uav sends location info on server , has php code returns sensor values upon relevant request (in geojson format, dont have much... phew). looking solutions how seamlessly using ajax when came across leaflet_ajax.. had lot of issues resolved questions on stackoverflow illustration this one , few others.

now here how writing code markers points:

var geojsonlayer = new l.geojson.ajax("myserver/get_geoj.php?stype=particle&sval[min]=2&sval[max]=26",{pointtolayer: redmarkers, oneachfeature: popup}); function popup(feature, layer) { layer.bindpopup(feature.properties.sensor_v); },

i have function redmarkers returns reddish colored circle markers. happens loading info server... phewh.... not bind popup or markers layer. looks (i guess some) default marker images in js/images/marker-icon.png marker symbol. doesnot exist , gives me error. if take random image , phone call marker-icon.png , set in desired location shows image on map still not bind popup.

what doing wrong. new stack overflow if need more info or if not asking question right please allow me know.

okay resolved it, thought else might similar mistakes later , should reply question.

i had accidentally edited leaflet.js file somehow. dont remember doing though. deleted dummy image had set in js/images folder marker-icon.png , still showing same marker. realized had cached disabled chache, realize in console error had leaflet.js. updated version of leaflet.js (had backup re-create on disk, same version didnt update or something), , works fine now. here current code

var geojsonlayer = new l.geojson.ajax(dataurl,{ pointtolayer: function (feature, latlng) { homecoming l.circlemarker(latlng, redregionstyle); }, oneachfeature: onfeature }); function onfeature(feature, layer) { layer.on( { mouseover: highlightfeature, mouseout: resethighlight }); layer.bindpopup(feature.properties.sensor_v.tostring()); }

it works highlights features , has popup bind features.

sorry bothered asking question own sily mistake

javascript ajax plugins maps leaflet

No comments:

Post a Comment