Select to view content in your preferred language

How to get the x and y coordinate of the selected point feature

682
2
05-15-2013 06:52 PM
FrancisSacdalan
Deactivated User
I need help on how to get the x and y coordinate of the selected point feature.

I have a point feature and I need to get the x,y of the selected point. Got no luck in this code.

        Dim pfcursor As IFeatureCursor
        pfcursor = pFLayer.Search(pQF, False)

        'get the first feature that matched that query
        Dim pfeature As IFeature
        pfeature = pfcursor.NextFeature
       
        Dim pgeometry As IGeometry
        pgeometry = pfeature.Shape
       
       Dim pPoint As IPoint = pgeometry

Suggestion and ideas are well appreciated. Thanks 🙂
0 Kudos
2 Replies
LeoDonahue
Deactivated User
Got no luck in this code.

Reminds me of an old tv show jingle.  It goes something like this:

Gloom, despair and agony on me.  Deep dark depression, excessive misery.  If it weren't for bad luck, I'd have no luck at all. Gloom, despair and agony on me


Anyone remember this show?


I believe there is a snippet that.  If not, start here:  http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/00010000049z000000.htm
0 Kudos
JeffMatson
Frequent Contributor
I need help on how to get the x and y coordinate of the selected point feature.

I have a point feature and I need to get the x,y of the selected point. Got no luck in this code.

        Dim pfcursor As IFeatureCursor
        pfcursor = pFLayer.Search(pQF, False)

        'get the first feature that matched that query
        Dim pfeature As IFeature
        pfeature = pfcursor.NextFeature
       
        Dim pgeometry As IGeometry
        pgeometry = pfeature.Shape
       
       Dim pPoint As IPoint = pgeometry

Suggestion and ideas are well appreciated. Thanks 🙂




You can use IPoint.QueryCoords:
http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//002m00000296000000


0 Kudos