[OpenLayers-Users] Tilecache, epsg 54004 and wrapDateLine

Martin Weinelt martin.weinelt at gmail.com
Mon Nov 19 12:34:03 EST 2007


Hi,

I am currently dumping all my Mapserver-related dom-scripting from the
last 2-3 years and replace it with OL. Thanks for this great project!

Among many others, the wrapDateLine-option on layers made it easy for
me to part with my stuff. I use it for EPSG 4326 (plate caree) and
54004 (Mercator).

Now with using tilecache I encounter a strange behaviour with Mercator
setting wrapDateLine to true (4326 works like charm). OL seems to try
wrapping around the dateline, but flips the visibility of the single
tiles depending on which 'side' (related to the dateline) of the map
takes hte bigger part of the viewport. some code:

OL:
    var MEoptions = {
      tileSize: new OpenLayers.Size(256,256),
      maxExtent: new
OpenLayers.Bounds(-20000000.0,-20000000.0,20000000.0,20000000.0 ),
      maxResolution:40000,
      units:'m',
      projection: "EPSG:54004",
      numZoomLevels: 8
    };

    map = new OpenLayers.Map( 'map',
{theme:'olay/theme/mytheme/style.css',controls: [],fallThrough:false }
);
    map.setOptions(MEoptions)

        gshhs    = new OpenLayers.Layer.MapServer( "Coastline (GSHHS)",
                       "http://www.example.com/shared/map/mapserv.cgi",
                       {map: mapFile, layers: 'gshhs', map_units: mapUnits },
                       {wrapDateLine: doWrapDateline,'isBaseLayer':
true, 'visibility': true});

        gshhs_tc= new OpenLayers.Layer.WMS( "GSHHS TC", "tilecache.cgi?",
                       {layers: 'gshhs_'+prjNick, format: 'image/png',
maxResolution: map.getMaxResolution(),
                        projection: map.getProjection(), bbox:
map.getMaxExtent()} ,
                       {wrapDateLine: doWrapDateline, isBaseLayer:
true, visibility: true});

     // this is a bit unusual because users can switch 'projections'
     // prjNick = 'ME', doWrapDateline = true

  tilecache.cfg:

[gshhs_ME]
type=WMSLayer
url=http://www.example.com/shared/map/mapserv.cgi?map=olME.map
layers=gshhs
extension=png
srs=EPSG:54004
bbox=-20000000.0,-20000000.0,20000000.0,20000000.0
maxResolution=40000
extent_type=loose

if I add layer 'gshhs' (a normal mapserver layer) to the map,
wrapDateLine works as expected,
but if I add 'gshhs_tc' to the map this 'flipping' behaviour around
the dateline occurs.

Any ideas anyone?

Thanks, Martin



More information about the Users mailing list