Horizontal, Vertical, Lenfth Units and NaN values

2120
3
10-30-2011 07:32 AM
RichardFairhurst
MVP Honored Contributor
I am wanting to enhance the VB .Net code I am developing to assign 3D length M values to a polyline according to whatever SpatialReference a user has for Horizontal and Vertical Datum.  Where a gap exists between two parts of a multi-part polyline, I want to be able to optionally calculate the 3D straight line length of the gap and add it to the measures.  Basically I am trying to emulate the behavior of the Create Route tool (except that the Route lines are already assumed to be assembled and oriented).

In the data I normally use my SpatialReference is projected and the units for horizontal length and vertical length are the same, which makes the calculations fairly easy.  However, that  configuration is not the case for everyone who might want to use the code and I would like the code to be able to handle that without requiring customization to each specific configuration.

So my primary issue is:  How do I extract the Horizontal and Vertical units from the feature class'  SpatialReference so I can standardize the output to match the horizontal length units reported by the feature class?  (Assumes a measure factor of 1.)

Related issues:  What approach should I adopt if the Vertical units are Unknown (request user input?, asssume same units as horizontal length units?, assume meters?, etc.)?  What approach should I take for segments that have nodes with NaN values for Z (provide a user specified option, read all surrounding segments until I find real values and interpolate or if one end has no real values hold the value of the other end?)?  Should I only use linear 3D length measures or should I optionally allow geodeesic length measures?  If I accomdate both, what is a reasonable approach to get geodesic lengths, given that I am not a Surveyor or mathematician?

Thanks for any input.
0 Kudos
3 Replies
RichardFairhurst
MVP Honored Contributor
Affter reading some of the help on working with the Spatial Reference I can see I am opening a can of worms in trying to accomodate all possible coordinate systems.  But I am looking for a some education on the subject.

I kind of understand that Projected Coordinate Systems (PCSs) have Linear Units and seem like they can be combined with Z Linear Units and outputted to the standard Horizontal Linear unit without a lot of difficulty.  There are some code examples for extracting parameters of PCSs.  But I am not sure what to do with the Angular units of a Geographic Coordinate System (GCSs) to combine them with Z Linear Unit values and output to a standard length unit value.  Also it is not clear whether the same parameter examples for PCSs apply to GCSs.

I know there are people on the forum who have looked into this far more than I have and I can definitely use some guidance and help in breaking it down.  Links to helpful code samples (preferably in C# or VB .Net) would also be appreciated.  It looks like Melita Kennedy at Esri gives most of the help on Coodinate Systems, so I hope she will pick up on this post to help me start a crash course on the subject.
0 Kudos
MelitaKennedy
Esri Notable Contributor
For a projected coordinate system (pcs), you can go directly to IProjectedCoordinateSystem::CoordinateUnit which returns ILinearUnit. You can then get its MetersPerUnit value from ILinearUnit. Similarly with a gcs, but now CoordinateUnit returns IAngularUnit with RadiansPerUnit.

Starting at ArcGIS 10, you can calculate the geodesic length with IPolycurveGeodetic::LengthGeodetic. This is a 2D (well, on the spheroid/ellipsoid surface) calculation. We don't yet support geodesic distance calculations that include heights.

I know the 3D team calculates a conversion value when horizontal coordsys is geographic to match up with the z values. It helps that data is usually large scale, so you can make an assumption. A rough equivalency is that 1 deg north-south is about 110 km. However, this only holds east-west at the equator. A rough estimate for east-west is 110 km * cos(latitude). Thus, at 60N or 60S, a degree is around 55 km. How the 3D team balances that out, I don't know.

Melita
0 Kudos
RichardFairhurst
MVP Honored Contributor
Melita:

Thank you for commenting on this thread.  Your suggestions have helped me with PCS layers and have put me on the right track for GCS layers.  If I get stuck I will post back here.  Thanks again.
0 Kudos