Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to add a point in an existing feature class using .NET API of ArcGIS Server 10 in C# (Visual Studio 2008). I'm using a sample from ESRI Resource Center (ArcGIS_SimpleEdit_CSharp). The following shows the portion of the code that creates the new point using X/Y coordinates.

ESRI.ArcGIS.Geometry.IPoint aoPoint = 
    serverContext.CreateObject("esriGeometry.Point") as ESRI.ArcGIS.Geometry.IPoint;
aoPoint.PutCoords(actionRecord.Location.X, actionRecord.Location.Y);


// Create a feature and set its geometry and attributes to those specified by the
// passed-in action record
ESRI.ArcGIS.Geodatabase.IFeature feature = featureClass.CreateFeature();
feature.Shape = aoPoint;
feature.set_Value(featureClass.FindField("Name"), actionRecord.name);
feature.set_Value(featureClass.FindField("LocationId"), actionRecord.id);
feature.set_Value(featureClass.FindField(actionRecord.id), "1");
int trackingNumber = feature.OID;

// Commit the new feature to the database

But I need to use Latitude and Longitude (with decimal precision) instead of X/Y coordinates. How can I do that? Can I just use lat/lon instead of X/Y? Or I have to convert lat/lon to X/Y before assigning feature.Shape?

share|improve this question
Is this a trick question? Can't you just put your lat long coords in the call to the PutCoords Method? e.g. replace actionRecord.Location.X with -123.54678 and actionRecord.Location.Y with 45.890765... –  valveLondon Jun 2 '12 at 4:45
Oh no, it's not a trick question. I don't know that much about the ESRI Web API and I asked a wrong question. sorry about that. I'm going to update the question. –  Fred Jun 2 '12 at 14:18

1 Answer 1

up vote 1 down vote accepted

The key missing piece of information here is what spatial reference (coordinate system) your feature class is assigned, and what coordinate system the actionRecord coordinates are in. If they are different (which it sounds like they are) you will need to project the point geometry into the feature class's coordinate system.

The IGeometry, IGeometry2 and IGeometry5 interfaces all have different projection methods that you should consider. If you require a specific geographic transformation for example, use IGeometry2.ProjectEx.

Also be sure to assign your point geometry the correct spatial reference before projecting.

share|improve this answer
Thank you for your answer. I need to convert Lat/Long to GCS_WGS_1984 coordinate system. I think I should refer esriSRGeoCS_WGS1984 constant for GCS_WGS_1984, but I don't know how to refer to Lat/long coordinate system. Is there any specifice constant to refere to Lat/Long? –  Fred Jun 2 '12 at 22:22
I think it should be esriSRGeoCS_NAD1983 ((Datum NAD 83). Is that right? –  Fred Jun 2 '12 at 22:32
"Lat/long" is not a coordinate system; latitude and longitude are are simply angular units of measurement used by geographic coordinate systems (which both GCS_WGS_1984 and GCS_NAD_1983 are), so no, there is no specific constant to refer to "Lat/Long". Only you can tell us which coordinate systems your data use. If you need to project between GCS_NAD_1983 and GCS_WGS_1984 check out this page to determine the correct transformation to use. –  blah238 Jun 3 '12 at 0:02
Ok I'm sure the coordinate system is GCS_WGS_1984 and when I add a point in X/Y format (like -13069019.954 6268616.389 Meters) everything is fine. But the thing is I have a list of Lon/Lat (like -117.396947, 48.964884) for the same point). How can I use the Lon/Lat instead of X/Y. I'm sorry if you find my question stupid. I'm a newby in GIS Web development. –  Fred Jun 3 '12 at 18:36
Not at all, but there is still some missing information or confusion. There are TWO coordinate systems involved here: the one used by your feature class, and the one used by your list of points. From the sounds of it, your feature class uses a projected coordinate system (since it is in meters, apparently), and your list of input coordinates is in a geographic coordinate system (GCS_WGS_1984?). You need to find out what your feature class's coordinate system is so you can project from one into the other. –  blah238 Jun 3 '12 at 20:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.