[gdal-dev] OGR distance different than in ArcGIS
Frank Warmerdam
warmerdam at pobox.com
Wed Mar 6 15:54:16 PST 2013
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 <ustroetz at 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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130306/740d3f8c/attachment.html>
More information about the gdal-dev
mailing list