Uli, You might want to elaborate on in what ways the results differ. Perhaps for a concrete example pair of geometries. The GDAL/OGR Distance is going to give planar distance in "decimal degrees" if everything is in geographic coordinates without regard to ellipsoidal geometries. I suspect the ArcGIS algorithm is actually giving a distance in meters - possibly for the great circle path from the closest points. If that is what you need, a different approach will be needed.
Best regards, Frank On Wed, Mar 6, 2013 at 2:49 PM, Uli Strötz <ustro...@gmail.com> wrote: > > 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 > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev > -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Software Developer
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev