3

I am using Mapserver-wms-openlayers for publishing maps. But there are some issues came across related to duplicate labeling for same feature in adjacent tiles, unwanted breaks in line features along tile borders, labels cut along tile boarders. Not much documentations to clear this anywhere. Can I create single tile using mapserver wms? Just increasing the tile-size to container (map-div) size is enough?

My code is:

map = new OpenLayers.Map('map',
  {zoomDuration: 1,projection: 'EPSG:3857'}
);

var mymap_all = new OpenLayers.Layer.WMS("EOL",
"http://192.168.0.233/cgi-bin/mapserv?map=/var/www/ms‌​test/test_plant.map",
  {'layers':"map_outline",
   'transparent':true,
   'format':'image/p‌​ng'},
  {isBaseLayer: false,opacity: 100},
  {singleTile: true, ratio: 1}
);

var gmap = new OpenLayers.Layer.Google("Google Streets", // the default
  {numZoomLevels: 25,visibility: false},
  {isBaseLayer: true}
);

map.addLayers([mymap_all,gmap]);

See the cut off and duplicate labels along tile birders

See an individual tile.

4

This is a comparison between multiple tiles and single tile using WMS in OpenLayers:

var map = new OpenLayers.Map({
    div: "mapDiv",
    layers: [
        new OpenLayers.Layer.WMS(
            "Single Tile", 
            "http://vmap0.tiles.osgeo.org/wms/vmap0",
            {layers: "basic"}, 
            {singleTile: true, ratio: 1}
        ), 
        new OpenLayers.Layer.WMS(
            "Multiple Tiles", 
            "http://vmap0.tiles.osgeo.org/wms/vmap0",
            {layers: "basic"}
        )
    ],
    center: new OpenLayers.LonLat(6.5, 40.5),
    zoom: 4
});

map.addControl(new OpenLayers.Control.LayerSwitcher());

Here is the example:

http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/single-tile.html

Since you are also dealing with Google basemaps, you need to add mercator projections to your mapfile, these posts can guide you to do so:

with WFS:

http://geographika.co.uk/mapserver-openlayers-and-the-wfs-maze

Basically you need to adapt your projection settings (in OL and MS) to allow the correct display of your layers together.

Since MapServer understands WMS, you just need to pass your map file data as WMS like here. About your labels, using PARTIALS may solve your issue.

| improve this answer | |
  • But, I am using Mapserver wms over google map. Code: – mapsir Jan 15 '14 at 8:50
  • @mapsir please take a look at my answer, I recently updated it. – Gery Jan 15 '14 at 9:18
  • Web portion already has got SRS info for both my wms and google. "wms_srs" "EPSG:4326 EPSG:3857" And tried both values for PARTIALS. Still I donot get single tile, but broken & duplicate labels. I will add an image to the question. – mapsir Jan 15 '14 at 9:39
  • @mapsir how do you know you have only a single tile? only for the labels? I'd be good if you can make a live demo to see the problem. – Gery Jan 15 '14 at 9:51
  • 3
    Added POSTLABELCACHE FALSE and PROCESSING "LABEL_NO_CLIP=ON" to the mapfile with other before mentioned parameters and label issue is solved. Now I can avoid single tile case. – mapsir Jan 15 '14 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.