I want to determine the shortest distance between a point and a line. I use
the following Python script to do so. If I compare the result of the script
with the result of ArcMap's Near Analysis, I get a completely different
results. The shapefiles are in the CRS GCS_North_American_1983 and
projected with Albers. What could be the reason for the difference?
import ogr
driver = ogr.GetDriverByName('ESRI Shapefile')
lineshp = driver.Open('U:/My Documents/Tool/shp/line.shp', 0)
linelyr = lineshp.GetLayer()
pointshp = driver.Open('U:/My Documents/Tool/shp/point.shp', 0)
pointlyr = pointshp.GetLayer()
line = linelyr.GetNextFeature()
point = pointlyr.GetNextFeature()
line_geom = line.GetGeometryRef()
point_geom = point.GetGeometryRef()
dist = point_geom.Distance(line_geom)
print dist
Thanks ahead!
Uli
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev