[Mapserver-users] GRID problem - temporary solution

Sebastian Albrecht api at justapi.de
Thu Nov 27 06:48:14 EST 2003


Hello,

concerning the GRID problem I have just made a solution that should be
temporary because it is just a workaround.

This workaround works with all layers that contain features which are
located far beyond (or equal) the earth's latitude borders of 90 and -90
degrees. This will be a problem if you use projections that do not work
using these values (like Mercator merc or Albers aea).

I modified the "mapproject.c" file in the mapserver source directory. The
method "msProjectPoint" does nearly all projection work. I replaced these
lines in that method with the following ones:


if( pj_is_latlong(in->proj) )
{
     point->x *= DEG_TO_RAD;
     point->y *= DEG_TO_RAD;
}


replaced by:

if( pj_is_latlong(in->proj) )
{
     if(point->y >= 90)
	point->y = 89.9;
     else if(point->y <= -90)
	point->y = -89.9;

     if(point->x >= 180)
	point->x = 179.9;
     else if(point->x <= -180)
	point->x = -179.9;

     point->x *= DEG_TO_RAD;
     point->y *= DEG_TO_RAD;
}

Values that reach until 90 or -90 will be replaced by 89.9 which is a valid
value for the most projections.

Now recompile your mapserver and your graticule and all other layers will
not intersect in the center of the map any more.

Best regards,
Sebastian Albrecht



More information about the mapserver-users mailing list