Hello,
I am facing issue to remove marker from SimpleMarkerOverlay. also I have tried with creating new object of SimpleMarkerOverlay so that it will create a new instance of that and pass it to map. Also it pass new MapX and MapY coordinates but still it shows old marker on map.
I have used CloudPopup to show popup on map and bind that popup from client side on map. CloudPopup shows at proper place but issue is with Marker it shows still at the same position if I pass new MapX and MapY coordinates.
I am pasting my code.
WebImage wimage =newWebImage(Url.Content(“ShapeFiles/Images/Locate.png”));wimage.ImageOffsetY = -30;wimage.ImageOffsetX = -10;
SimpleMarkerOverlay markerOverlay =newSimpleMarkerOverlay(“markerOverlay”);markerOverlay.OnClientClick =“clickOnMarker”;Marker mrk =newMarker(ps, wimage);mrk.IsVisible =true;
markerOverlay.Markers.Add(mrk);map.CustomOverlays.Remove(“markerOverlay”);map.CustomOverlays.Add(markerOverlay);
CloudPopup popup =null;popup =newCloudPopup(“Popup”, ps, Content, width, height,true,true);popup.IsVisible =true;returnpopup.ToJson();
And here is code on client side to call function to add Marker and call back function to add Popup on map.
functionShowMarker(htmlcontent,pLon,pLat){varparams = { lon: pLon, lat: pLat, content: htmlcontent };Map1.ajaxCallAction(‘Home’,‘AddMarker’, params, mapCallback);}
functionmapCallback(result) {varolMap = Map1.getOpenLayersMap();for(vari = 0; i < olMap.popups.length; i++) {olMap.removePopup(olMap.popups);}
varjsonPopup = JSON.parse(result.get_responseData());varpopupCreator =newPopup(jsonPopup,null);olMap.addPopup(popupCreator.element,true);Map1.redrawLayer(“MarkerOverlay”);}
Please check the code and let me know if I made some mistake in this.
Thank you.