[MapServer-users] different shapefiles but same render
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Wed Jul 16 09:28:33 PDT 2025
Hi,
If I understand right what you do, the behavior is expected. I mean that if you GetMap query contains
&layers=layer1,layer2
then by the WMS standard both layers are rendered. The "layer1" is rendered first at the bottom, and "layer2" is rendered above it.
You do not need to make a separate mapfile for each shapefile, just decide what layer you want to get rendered, and use that in &layers=
I apologize if I have understood your issue wrong.
-Jukka Rahkonen-
________________________________________
Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> käyttäjän mathias cunault via MapServer-users <mapserver-users at lists.osgeo.org> puolesta
Lähetetty: Keskiviikko 16. heinäkuuta 2025 9.14
Vastaanottaja: MapServer Users <mapserver-users at lists.osgeo.org>
Aihe: [MapServer-users] different shapefiles but same render
Mapserver 7.6 & OpenLayers 10My mapfile has to layers from 2 shapefiles :WEB METADATA"wms_title" "WMS-Inrap, natura 2000""wms_onlineresource" "http://caviar.inrap.fr/cgi-bin/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile/fond_iliad_natura.map""wms_enable_request" "*" #active les getcapabilities, getmap, getfeatureinfo, getfeature"wms_srs" "EPSG:3857 EPSG:2154 EPSG:900913""wms_encoding" "UTF8""ows_enable_request" "*"END ENDLAYERNAME "znieff1_metropole"TYPE POLYGONSTATUS DEFAULTOPACITY 30 DATA "./ressources_couches/ZNIEFF/znieff1.shp"PROJECTION"init=epsg:2154"END #fin projection#MAXSCALEDENOM 100000LABELITEM "etiquette"CLASSNAME "znieff1" #apparait en legendeSTYLECOLOR 255 0 0OUTLINECOLOR 255 240 140WIDTH 0.5END #end STYLELABEL #apparait pour chaque entité sur la carteFONT "DejaVu_bold"COLOR 255 240 140OUTLINECOLOR 0 0 0OUTLINEWIDTH 0.5POSITION ccSIZE 9TYPE TRUETYPESHADOWCOLOR 100 100 100MAXSCALEDENOM 60000 #apparait à partir de 1/MINSCALEDENOM 7000 #apparait jusqu'à 1/END #ENd labelEND # end classMETADATA"wms_title" "znieff1""wms_srs" "EPSG:3857 EPSG:2154" END #fin metadata END #end layer#-----debut layer znieff2LAYERNAME "znieff2_metropole"TYPE POLYGONSTATUS DEFAULTOPACITY 30 DATA "./ressources_couches/ZNIEFF/znieff2.shp"PROJECTION"init=epsg:2154"END #fin projection# MAXSCALEDENOM 100000LABELITEM "NOM"CLASSNAME "znieff2" #apparait en legendeSTYLECOLOR 255 0 250OUTLINECOLOR 255 0 250WIDTH 0.5END #end STYLELABEL #apparait pour chaque entité sur la carteFONT "DejaVu_bold"COLOR 255 240 140OUTLINECOLOR 0 0 0OUTLINEWIDTH 0.5POSITION ccSIZE 9TYPE TRUETYPESHADOWCOLOR 100 100 100MAXSCALEDENOM 60000 #apparait à partir de 1/MINSCALEDENOM 7000 #apparait jusqu'à 1/END #ENd labelEND # end classMETADATA"wms_title" "znieff2""wms_srs" "EPSG:3857 EPSG:2154" END #fin metadata End #end layerIn Openlayers, I have defined two sources and two layers, example :const sourceWMSznieff1 = new ImageWMS({ // serverType: "mapserver", projection: "EPSG:3857", params: { LAYERS: "znieff1_metropole", // _t: Date.now(), }, url: "http://.../mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile/fond_iliad_natura.map&",})export const coucheWMSznieff1 = new ImageLayer({ title: "znieff1", source: sourceWMSznieff1,})Only LAYERS and title are changing for the second source and layer Image.In my browser, layers are different, i.e. they display their own datas, only when I am loading just one.But loaded together the two layers render the total features of the 2 shapefiles, so in a way the layers are duplicates.Does it mean I have to create a mapfile for each shapefile ? (it seems weird to me and I have many shapefile
More information about the MapServer-users
mailing list