Calculate Geometry via ArcObjects - Using Data Frame Projection

709
1
Jump to solution
12-03-2013 12:49 PM
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Hey all,

I'm modifying an existing program we use which originally took input from a .dxf layer (which had a spatial reference of a UTM Zone). Now, I'm asking the user for a .GPX file, then use code to geoprocess (GPX To Feature), and then from there do some other functions that are not really relevant, except for one: calculating geometry.

My goal is to populate fields for easting and northing, using the data frame coordinate system (see further below).

The points I'll be getting (from my above processing) will be a feature class in a geodatabase in Geographic WGS84 (the default spatial reference of the GPX to Feature tool). I believe using IPoint.X and IPoint.Y will return values based on the layer (correct me if I'm wrong) which would result in incorrect data for what I'm after.

So, essentially I want to select a field, let's call them "UTM_E" and "UTM_N" and basically: perform a right-click -> Calculate Geometry, using meters as the unit, and the data frame as opposed to the layer, and the appropriate X or Y coordinate drop-down choice.

Seems simple enough to me, but I really don't know where to look.

I think what I'm going to do is tell the user to pick UTM Zone 11 or 12 as the data frame projection at the start of the program (the user will know for sure where the points are), and then go from there.

Anyways, I feel like a push in the right direction will suffice, so any suggestions are most welcome, and if it's not possible, what would be a useful alternative?

Thanks very much!
0 Kudos
1 Solution

Accepted Solutions
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Update: it appears I may have overlooked the code I'm modifying as I just found a snippet that appears to create a spatial reference for temporary use, calculating geometry. The original code creates a geographic coordinate system (NAD83), to calculate decimal degrees.

I think at this moment, I'll close this and re-open if I fail at modifying the snippet for my own use.

View solution in original post

0 Kudos
1 Reply
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Update: it appears I may have overlooked the code I'm modifying as I just found a snippet that appears to create a spatial reference for temporary use, calculating geometry. The original code creates a geographic coordinate system (NAD83), to calculate decimal degrees.

I think at this moment, I'll close this and re-open if I fail at modifying the snippet for my own use.
0 Kudos