[GRASS-dev] latlon support

Markus Metz markus.metz.giswork at googlemail.com
Tue Jan 27 05:20:48 EST 2009



Glynn Clements wrote:
> By "Euclidified", I mean that the data is in a form such that code
> which process it can treat -179 and +181 as being distinct points 360
> units apart.
>   
It seems that grass treats -179 and 179 as being 2 units apart, I do not 
have to change it to 179 and 181. Latlon coords are apparently not 
always but sometimes treated as not being "Euclidified", when getting 
map extends they are forced into the 180 degree limits, when writing out 
a vector feature they are left as they are.
>   
>> ... It may be safer to convert coordinates to 
>> the 180 deg lon and 90 deg lat limits and take the shortest way between 
>> two points.
>>     
>
> My point is that this needs to be done in the lowest-level libraries,
> not in higher-level libraries or the modules.
>   
I had to do that in the module, the vector libraries do not convert 
latlon coords to these limits although these limits are required by 
other library code. You can write a vector in latlon with whatever 
coordinates you like, but such a vector may not be processed properly. 
This does not apply to raster maps because these are (almost) always 
restricted to the current region settings.
> High-level code must be free to assume that eastings increase
> monotonically from left to right, that if a point has an easting of x,
> then the point which is d units to its east has an easting of x+d, and
> so on.
>   
This is currently not the case with library code, at least with regard 
to map extends. If the Western edge of a map is at -179 and the Eastern 
edge is at +181, the map extend is not calculated as (East - West) but 
as (East - 360 - West).
> Requiring code to explicitly use specialised (spherical-aware)
> functions in place of +,-,<,>,== etc is not a realistic strategy.
>   
It seems the display does so when zooming out or panning. The Chukchi 
Peninsula and other features are copied around and displayed on both 
sides, I haven't done that in the vector, there all features are present 
only on one side. This is not a complaint about the display, I like it 
that way.

I think my questioning started because the region settings including map 
extends are restricted to the 180 degree lon and 90 degree lat limits 
whereas vector operations can exceed these limits causing problems later 
on. To make grass handling of latlon coordinates consistent all around, 
either the limits on region settings must be relaxed (taking care of all 
the associated risks) or latlon vector coords must be forced into the 
latlon limits by some lower-level handling.

The currently allowed mix is confusing.




More information about the grass-dev mailing list