Search code examples
javascriptarcgisesri

How to add markers to ArcGIS map with XY coordinates


How do I add markers to a map with coordinates? I saved the extent in database along with X,Y coordinates after finding the location. When coming back to the application, I don't know how to add markers with coordinates.

var s =  "XMin: " + ext.xmin + 
        " YMin: " + ext.ymin +
        " XMax: " + ext.xmax + 
        " YMax: " + ext.ymax;
document.getElementById('extent').value = s;  

function showCoordinates(evt) {
    //get mapPoint from event
    var mp = evt.mapPoint;
    //display mouse coordinatesLabel1
    dojo.byId("Label1").innerHTML = mp.x + ", " + mp.y;
}

Please help me with setExtent! Thanks.

Updated:

I am using the ESRI map on the client side and I'm trying to refresh with asp:button; that's the reason why the map didn't get refreshed.


Solution

  • You can add marker using this example: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

    Hope this helps Cheers Al