[gdal-dev] OGRGeometry Distance

Yilmaz Arslanoglu yilmaz.arslanoglu at gmail.com
Mon Sep 21 11:06:39 EDT 2009


Hi all;

I wanted to compute the distance between two points,
and for this reason I tried the "OGRGeometry::Distance" member function.

However, I saw that this function only returns the linear
distance between the objects, regardless of their geospatial reference.
(as it is also stated somewhere on the net that GEOS library
implements it this way)

So I would like to compute the actual distance between the points,
let's say,
      23 degrees north, 30 degrees east
and
      25 degrees west, -5 degrees east.

My question is, do we need to implement this functionality by using
projection transformations etc., or is there an easy way to do this
using the OGR library?

Also, as another related question, I query the DEPCNT  layer in one of
my ENC files, and it has a geospatial reference.
However, the points on the line string features themselves return NULL
when they are queried with getSpatialReference().
Aren't they expected to return exactly the same instance for the layer
that they reside on?

Regards,
Yilmaz


More information about the gdal-dev mailing list