[mapserver-dev] WorldMapping issue

Frank Warmerdam warmerdam at pobox.com
Mon Feb 22 08:33:30 EST 2010


strk wrote:
> Hi all,
> I've been reading the WorldMappingIssues [1] wiki page and did not
> find a use case which I belive would be useful (or at least worth
> discussing).
> 
> [1] http://trac.osgeo.org/mapserver/wiki/WorldMappingIssues
...
> Now you want to render that data _multiple_times_
> over a zone which is bigger than the valid extent:
> 
>    . . . . . . . . . . . . . . . . . . . . . . . . .
>    .               .               .               .
>    .   +-------+   .   +-------+   .   +-------+   .
>    .   |       |   .   |       |   .   |       |   .
>    .   +-------+   .   +-------+   .   +-------+   .
>    .               .               .               .
>    . . . . . . . . . . . . . . . . . . . . . . . . .
>    |   |       |   |   |   |   |   |   |       |   |
>   -8  -6      -2   0   2   4   6   8  10      14   16
>   (0) (2)     (8) (*)             (*) (2)     (6)  (8)
> 
> Points 0 and 8 are the same (think dateline).
> Ordinate values between parens are computed
> "wrapping" around valid range.

Strk,

This is a use case of interest.  A simple example is to
make a request in WGS84, for instance for the region
-360 to +360 so that their ought to be two copies of the
whole world side by side.

I am not positive how this would be handled currently, but
the following is a guess:

1) WGS84 input vector data: Only one copy of the vector
objects would be rendered in the result, in the same range
as the input vector data was (usually -180 to 180).

2) Non-WGS84 input vector data: As above, but almost
certainly in the range -180 to 180 since that is how
PROJ.4 will wrap the data.  The special MapServer dateline
logic might "hold together" shapes crossing the dateline.
So islands crossing the dateline might extend a bit past
180/-180 but only would appear on one side or the other
of the map.

3) WGS84 Raster input: If nothing triggers the raster
resampler (like a difference of coordinate system or
requesting PROCESSING "RESAMPLE=XXX") then one copy of
the raster would be produced.

4) Resampled Raster input: If the raster resampler is
triggered - most often by a difference of coordinate
system then the data will be replicated.  This is because
MapServer loads the region of interest into a secondary
buffer (in this case certainly the whole dataset) and
then it (roughly) reprojects each pixel to the source
image coordinate system.  Since multiple locations will
point back to a single location on the source image
(ie. -200 and +160) you will essentially see the raster
replicated.

I think one interesting point about this use case is
just how the behavior subtly differs depending on the
nature of the input data (vector vs. raster, same projection
as request vs. different projection).

> Note that in this case it's not a single shape which
> goes "beyond" valid extent (which is discussed on the
> wiki). 
> 
> Also note that letting this handled by the client (say OL
> with wrapDateLine) has the limit of not dealing labels and
> the need of knowing more about the WMS projection.
> 
> Maybe support for this is already implemented and I'm unaware
> (very likely) so I'd appreciate any informations about that.

I would say this case is not well/consistently handled currently.

I *suspect* the best way to handle it well would be for MapServer
to understand something special about the dateline, at least about
geographic coordinate systems, and to split dateline crossing
requests into two or more requests.

So the -360 to +360 case should be broken into 3 requests:

-360 to -180 which would be internally rendered as 0 to 180.
-180 to +180 which would be rendered as -180 to +180
+180 to +360 which would be rendered as -180 to 0.

Then the three results should be mosaiced back together.
Unfortunately this would require a fair amount of development
work.

I do not thing it would be practical to recognize limits to
projected coordinate systems and to use such a technique
though similar wrapping issues can apply in projected
coordinate systems as well.  For instance this is
fairly straight forward in mercator, but complicated in
many projections like the perspective view ones.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-dev mailing list