Accessing the End Points of a Polyline Segment

642
2
12-14-2010 09:33 AM
TomGiles
New Contributor
This seems so easy in theory, but I can't seem to find out how to get the end points of a polyline segment / polyline.

I have a selected polyline 'pLineF', type esriGeometryPolyline, for which I want to know the start and end points.

I have been able to get at the extent (bounding rectangle) by:
pLineF.Shape.Envelope (as an IEnvelope)

I have tried using pointCollections but cannot seem to get the code right.


I don't need code, if you have any comments please, I just need a push in the right direction.

Cheers,
Tom
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
Looks like you have an IFeature reference so just QI to IPolyline.  Use IPolyline.FromPoint and IPolyline.ToPoint.
0 Kudos
TomGiles
New Contributor
Thanks for your quick reply Neil.

Believe it or not - and I don't even want to post this here - when I originally tried the [ipolyline] = [ifeature] 'QI' I forgot the .Shape ...

for others:

'where pFeat is an IFeature:

Dim pPolyline As IPolyline
pPolyline = pFeat.Shape 'QI

and then access pPolyline.FromPoint, etc

Really easy.

Thanks again Neil.
Tom
0 Kudos