[gdal-dev] Length method for geometries in bindings

Frank Warmerdam warmerdam at pobox.com
Thu Feb 18 11:23:42 EST 2010


Ari Jolma wrote:
> Frank Warmerdam wrote:
>> Ari Jolma wrote:
>>> Folks,
>>>
>>> I added a Length() method for geometries into bindings. The method 
>>> re-dos a simple euclidean distance as the get_Length of OGR proper is 
>>> not exposed.
>>
>> Ari,
>>
>> I'm not clear on why you reimplemented it for the bindings instead of
>> just exposing it from the core, and adding a binding around it.
> 
> I simply don't feel confident enough on changing the C API as I've so 
> far only worked on the bindings.

Ari,

I'm happy to provide a C API entry point if you would be willing to
recast the SWIG function to use it.  Let me know if you are interested.

>>> I hope this is ok. Length is in OGC SF with that name. However, the 
>>> standard specifies that the length should be in its associated 
>>> spatial reference and that's not the case here.
>>
>> I don't understand this statement.  In what way is the length not being
>> returned in the linear measure of the spatial referenced associated with
>> the geometry?  It seems to be - it seems to me something special would
>> need to be done to make that not-true.
> 
> For example if the data is in geographic coordinates then the distance 
> between two points is not euclidean distance.

I would disagree.  If the data is in geographic (lat/long) degrees then
the distance will be in "linear degrees", computed as a euclidean distance.
So the distance is returned in the coordinate system of the geometry.

What we don't offer is a real (ie. great circle distance in meters) length
of the geometries.

Best regards,
-- 
---------------------------------------+--------------------------------------
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 Programmer for Rent



More information about the gdal-dev mailing list