How to add markers to ArcGIS map with XY coordinates

Vani picture Vani · Jan 28, 2011 · Viewed 8k times · Source

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.

Answer

Al Pascual picture Al Pascual · Mar 6, 2011

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

Hope this helps Cheers Al