Select to view content in your preferred language

Use of NEAR-Tool (Proximity Tools) on a point geometry object with Python

386
0
11-30-2010 06:12 AM
SeldaSamiri
Emerging Contributor
Hi there,

I have a stream polyline and sampling sites as points. As the points are not accurately located on the stream lines, I want to calculate the correct XY-coordinates with the "near"-Tool.

I want to do this in Python with other geoprocessing tasks in a row and every point one by one.
My question:
Is it generally possible to use this tool on a geometry object instead of a Feature Class? Does a geometry object actually have attributes like in the attribute table of a Feature Class that I can read out afterwards?
Maybe this is a stupid question, but I'm quite new to Python and using Geometry objects.

My code that I tried looked like this, but I have no idea, how to get now the XY-coordinates from the results...:

def find_PS_XY_on_streams (PS, streams):
    g = arcpy.Geometry()
    searchRadius = "30 Meters"
    location = "true"
    near_XY = arcpy.Near_analysis(PS, streams, searchRadius, location)
    return near_XY


FC = "points"
stream_FC = "River"

g = arcpy.Geometry()
geometryList = arcpy.CopyFeatures_management(FC, g)

for geometry in geometryList:
    PS_XY = find_PS_XY_on_streams (geometry, stream_FC)


Thanks for any help!
Selda
0 Kudos
0 Replies