# Geometry :

Subject: [ggl] Hello + some newbie questions
From: Barend (barend)
Date: 2009-05-10 14:46:44

Hi Mateusz,
>>>> The functions forward/inverse return true/false and I will come
>>>> back to these.
>>>>
>>>>
>> should they raise an exception here? It is
>> here different than in WKT. The point might be not in reach of the
>> projection. That is not really "exceptional", it just can happen.
>> Should it then raise an exception? It is not really an error.
>> However, propagating true/false is also not that nice. So what will
>>
>
> IMHO, it depends on how the point-out-of-proj is considered in
> terms of the state of program/engine.
> If the result is still usable, though not accurate, then exception is too "strong" option.
>
OK, this accurateness is a good idea! I was thinking about that further.
Each projected point has an "accurateness". (Usually) the center of a
projection will have a high accurateness. At points on "the border" the
accurateness will be very low. So that information should be returned
somehow. I was first thinking of a scale from 0 to 1, but the actually
distance (deviation, in meters) of the projected point seems more
appropriate and better measurable. So let's say we have Mercator and
project the city Lima. It's near the equator so the distance between the
center (in this case the equator above Lima) and measured via the
projection vs measured via the Earth ellipsoid is not much. Then let's
say we project the city Godth?b, in Greenland, well-known for its bad
display on most maps. The deviation in meters between the equator below,
and Godth?b, will often be very large. We can return that deviation. One
problem though, calculating deviation increases calculation time...
Though the (currently used, not well-known) Andoyer-distance is not too
slow.

Performance penalty could be solved by introducing "laziness".
Projecting a point results in a "projection structure". Like the
"distance_struct' for cartesian distances. It returns immediately,
having done nearly nothing. As soon as converted to a point, it does the
actual projection. If the "deviation()" method, or double() conversion,
or so is called, it calculates the deviation. OK, if the user still
wants to have both, the performance decreases then. But if he wants only
the projection, the performance is the same as it was... He then can
also request deviation only, and if it is not too bad get the projected
point as well.

> However, if such situation is not acceptable for further processing,
> then exception seems to be proper option.
>
That is probably a bit ambiguous for most projections. Some projection
will have a clear distinction, we then can raise an exception. Others
will have a gradual "deviation" until the projected point is really
unusable.

Regards, Barend

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20090510/98926e52/attachment.html

Geometry list run by mateusz at loskot.net