Select/ Get a single Line of a Polyline (contour) C#

565
1
07-27-2011 06:10 AM
SebastianKrings
Occasional Contributor
Hi,

I want to access one specific contourline out of all contourlines stored in one polyline.
The thing is, that I want to know the altitude of the specific line.

Given are some points and a cotnour featureclass. Every Point lies on a contourline.
For every Point I now want to have the altitude.
Maybe the points lie not exactly on a contourline. So a selection may shall go with the option of some tolerance.

I cant find an object to access a location of the polyline or to get access to a single line.

Thanks for help.
0 Kudos
1 Reply
DubravkoAntonic
New Contributor III
The altitude of specific line is stored in the base objects geometry which is point, Z attribute.
Polyline is a collection of Paths, And Path is collection of points. So you can:

// access to paths within polyline
IGeometryCollection pathCollection = pPolyline as IGeometryCollection;

// get single path from path collections
IPath contourlinePath = pathCollection.get_Geometry(i);

// get points within path
IPointCollection contourLineColl = contourlinePath as IPointCollection;
IPoint counterLinePoint = contourLineColl.get_Point(i);

double alt = contourLinePoint.Z;

Hope this will help
0 Kudos