[GRASS-dev] latlong problem

Glynn Clements glynn at gclements.plus.com
Thu Mar 8 01:43:10 EST 2007


Hamish wrote:

> > Personally, I'd be tempted to just treat the 180th meridian as a
> > discontinuity (New Zealanders and Japanese would have to stick to
> > using projected locations).
> 
> aw, come on Glynn. I could just as easily argue that folks in the UK
> should stick to using projected locations and GRASS enforce 0-360.
> It's no solution.

No, the only *solution* is to write two versions of every piece of
code which deals with coordinates. One version would use the rules of
Euclidean geometry and would work with projected coordinates, the
other would use the rules of non-Euclidean (specifically, elliptical)
geometry and handle lat/lon coordinates.

The problem arises when you try to use the same code (with a couple of
minor tweaks) for both cases.

So far as vector data is concerned, the simplest solution would be to
ensure that wraparound never occurs within a single polygon (e.g. a
triangle on the 180th meridian would be [(180,10),(170,0),(190,0)],
and not [(180,10),(170,0),(-170,0)].

OTOH, that could create problems when edges are shared between
polygons. It would probably mean that a whole-earth map would span
more than 360°. Rendering regions crossing the 180th meridian would be
problematic (well, you could just render the data twice, with a 360°
offset).

That still doesn't allow for polar regions; realistically, you would
need to "cut" such regions so that the pole formed a vertex.

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




More information about the grass-dev mailing list