How to cast a shape field from a table as a polygon, line or point feature shape fiel

584
1
02-14-2013 03:37 PM
JoseSanchez
Occasional Contributor III
Hi all,

I am doing a search by attributes on a feature class and when I retrieve the whoe, record I would like to get the information in the attributes tables under Shape as a Point shape to obtain the X and Y coordinates.

How can I do that?

I am using VB.net

thanks
0 Kudos
1 Reply
MarcinDruzgala
Occasional Contributor
Hi all,

I am doing a search by attributes on a feature class and when I retrieve the whoe, record I would like to get the information in the attributes tables under Shape as a Point shape to obtain the X and Y coordinates.

How can I do that?

I am using VB.net

thanks


Sorry im not familiar with vb.net but here you have c# sample I wrote in my utility:
//let's assume you've already used some kind of searching in the feature class and you get the featurecursor
//shape of the feature class is Point, but you can do it with polyline and polygon too 
IFeature feature = featCursor.NextFeature();
while (feature != null)
{
 IPoint point = (IPoint)feature.Shape;
 double X = point.X;
 double Y = point.Y;
 double Z = point.Z;
 //more logic
 ...
 feature = featCursor.NextFeature();
}



Hope it helps,
MDruzgala
0 Kudos