[GRASS-dev] latlong problem

Glynn Clements glynn at gclements.plus.com
Wed Mar 7 09:03:32 EST 2007


Martin Landa wrote:

> there is a significant problem in LatLong location. Try the following:
> 
> g.region n=80 s=-80 w=-170 e=170 res=1;
> v.in.region out=reg;
> g.region n=90 s=-90 w=-180 e=180 res=1;
> d.erase;d.vect reg
> [1] should be [2]

No, [1] is correct.

Given two points at the same latitude, each 10 degrees either side of
the 180th meridian, the line segment between them is deemed to be the
one which subtends 20 degrees and crosses the 180th meridian, not the
one which subtends 340 degrees and crosses the prime meridian.

IOW, "shorter" has a higher priority than "doesn't cross the 180th
meridian".

> I prepared a simple patch to fix this bug.

It isn't a bug. It may not produce your preferred result, but the
behaviour is quite intentional.

> I am not sure whether it is OK. Anyway testing "(east1 - east2) > 180"
> does not make sense to me... or am I wrong?

Longitudes are cyclic. This makes their behaviour rather
counterintuitive, e.g.:

	179 + 2 = -179
=>	-179 - 179 = 2
=>	-179 - 179 > 0
=>	-179 > 179

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list