Skip to content

Mapserver cutting off symbol close to tile edges

Inrap edited this page Mar 27, 2020 · 1 revision

Issue

Using an application with OpenLayers 6.2.1, Mapserver 7.6.0 and PostGis 3.0, some symbols with SIZE based on an attribute are not rendered completely.

MAPFILE :

...
LAYER
    NAME "nombre de cas"
    TYPE POINT
    PROJECTION
            "init=epsg:2154"
    END
    EXTENT 276838.0988 4584246.823 909596.998 8872270.142
    CONNECTIONTYPE POSTGIS
    CONNECTION blabla
    LABELITEM "nb_cas"
    CLASS                STYLE
                    SYMBOL "cas"
                    SIZE [ln_nb_cas]
                    COLOR [couleur]
                    OPACITY 70
            END #fin style
            LABEL
                    COLOR 0 0 0
                    OUTLINECOLOR 255 255 255
                    FONT "verdana-gras"
                    TYPE truetype
                    SIZE 8
            END
    END #fin class 

Sample of the javascript file :

	new TileLayer({
	source: new TileWMS({
		url: 'http://10.210.1.32/cgi-bin/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile    /covid19.map',
		params: {
			'LAYERS': 'nombre de cas',
			'FORMAT': 'image/png',
		},
		serverType: 'mapserver',
	})
})

symbol cut off

solution

A solution on the client side so to speak in the js.file, is to use the gutter option for ol/source/TileWMS.

	new TileLayer({
	source: new TileWMS({
		url: 'http://10.210.1.32/cgi-bin/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile    /covid19.map',
		params: {
			'LAYERS': 'nombre de cas',
			'FORMAT': 'image/png',
		},
		gutter: 50,
		serverType: 'mapserver',
	})
})
];

entire symbol

Clone this wiki locally