Select to view content in your preferred language

How to create a point and see what it intersects with

649
1
10-05-2010 07:30 PM
PeterTimmers
Frequent Contributor
Can anyone see anything wrong with the following code?

I'm not getting any intersections even though I know that point is definitely within myFeatureLayer.

How does that deal with projection?


pt = arcpy.Point(x,y)
    ptGeometry = arcpy.PointGeometry(pt)
    
    cur = arcpy.SearchCursor(myFeaturelayer)
    for arow in cur:
        geom = arow.shape
        if ptGeometry .touches(geom):
            arcpy.AddMessage("intersects")
            break
            
0 Kudos
1 Reply
SamuelBosch
Emerging Contributor
Could you try replacing ptGeometry.touches(geom) by ptGeometry.within(geom) or by ptGeometry.crosses(geom) because touches, according to the ArcGIS help, indicates if the boundaries of the geometries intersect. Within indicates if this geometry is contained within another geometry and crosses idicates if the t....

Succes,

Samuel
http://gissolved.blogspot.com
0 Kudos