Select to view content in your preferred language

Add point by coordinate on a map!

2389
2
Jump to solution
11-18-2014 12:06 AM
ArcGISG_I_S
Deactivated User

Dear all,

I am currently working on the closest facilities sample in ArcGIS API for JavaScript.

In the sample code they are adding a number of points to the map by using:

map.addLayer(facilitiesGraphicsLayer);
        facilitiesGraphicsLayer
.add(new Graphic(new Point(-13625960,4549921,map.spatialReference)));

I created a groupe of point in ArcMap and have their (x,y) coordinate using WGS 1984 Coordinate System and Decimal Degrees us units.

When i replace the values i could not find my points on the map!!

I think the problem is coming from my coordinate system and units i use??

If someone could provide me with some support i would be very gratefull.

0 Kudos
1 Solution

Accepted Solutions
OwenEarley
Frequent Contributor

The simplest solution would be to change the projection of your ArcMap document and calculate the XY coordinates. Go to your map document Data Frame Properties and select the Coordinate System tab. Search for 'web mercator' or browse to: Projected Coordinate Systems > World > WGS1984 Web Mercator.

Then you can use the Add XY tool to get the projected coordinates.

Alternatively, if you want to be able to do this for any point dynamically in the ESRI JS API use a Geometry Service to project your coordinates.

View solution in original post

0 Kudos
2 Replies
OwenEarley
Frequent Contributor

The simplest solution would be to change the projection of your ArcMap document and calculate the XY coordinates. Go to your map document Data Frame Properties and select the Coordinate System tab. Search for 'web mercator' or browse to: Projected Coordinate Systems > World > WGS1984 Web Mercator.

Then you can use the Add XY tool to get the projected coordinates.

Alternatively, if you want to be able to do this for any point dynamically in the ESRI JS API use a Geometry Service to project your coordinates.

0 Kudos
KenBuja
MVP Esteemed Contributor

Instead of using a Geometry Service, you can use the built-in webMercatorUtils class to project the points.

0 Kudos