3

I'm having difficulty troubleshooting why a number of my mapfile layers aren't rendering. I'm a GIS noob, so I'm probably missing something obvious and apologize in advance; I just don't know where else to turn to.

I built a map project in QGIS and arranged the layers how I'd like; everything displays fine there. But when I attempt to query MapServer for those same layers, only some of them are rendering.

To illustrate, here's an example of how I'm using the mapfile:

MAP
NAME "WASHINGTON_COUNTY"

SIZE 800 600
EXTENT 721132.369589 1497660.070845 825840.827167 1814625.359158
UNITS METERS
SHAPEPATH "geo"
TEMPLATEPATTERN "washington"
IMAGECOLOR 255 255 255
IMAGETYPE PNG

WEB
    HEADER templates/header.html
    TEMPLATE "set in index.html"
    FOOTER templates/footer.html
    MINSCALE 1000
    MAXSCALE 2550000

    IMAGEPATH "C:/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
END

LAYER
    NAME tiger_counties
    DATA "tiger_counties"
    STATUS OFF
    TYPE POLYGON

    CLASS
        NAME "county"

        STYLE
            COLOR 200 200 200
            OUTLINECOLOR 222 222 222
        END
    END
END

LAYER
    NAME ny_washington_centerlines
    DATA "ny/washington/centerlines"
    STATUS OFF
    TYPE LINE

    CLASS
        NAME "road"

        STYLE
            COLOR 255 255 0
            OUTLINEWIDTH 1
            OUTLINECOLOR 0 0 0
        END     
    END
END
END

And here's the image rendered from the query string:

"map_size=592+886&img.x=441&img.y=257&mode=browse&layer=ny_washington_centerlines&layer=parcels&zoomdir=0&zoomsize=2&imgxy=400.0+300.0&imgext=718662.996883+1676819.127354+824362.189500+1756060.449478&map=C%3A%2Fms4w%2Fapps%2Fwashington_county_mapserver%2Fwashington_county.map&root=%2Fwashington_county_mapserver%2F&map_web=+TEMPLATE+washington_main.html"

: enter image description here

Now here's a map of the same region, as rendered in QGIS: enter image description here

What is QGIS doing by default that MapServer doesn't?

4
  • Does it help if you add TRANSPARENT ON just above the IMAGECOLOR 255 255 255 part? See mapserver.org/mapfile/map.html for what that does.
    – BradHards
    Apr 7, 2014 at 6:49
  • Thanks, but that just made my background gray. I'm pretty sure MapServer just isn't reprojecting the layers correctly; I just don't know enough about that sort of thing to fix it. Apr 10, 2014 at 13:17
  • How are you adding the MapServer WMS layers to QGIS? Are you, for example, adding them one layer at a time?
    – nmtoken
    May 13, 2014 at 11:07
  • Also, what do you get when using the mapsever cgi controls like: http:[your service endpoint]?map=C%3A%2Fms4w%2Fapps%2Fwashington_county_mapserver%2Fwashington_county.map&mode=map&layers=tiger_counties%20ny_washington_centerlines& note the first named layer in this request is drawn first.
    – nmtoken
    May 13, 2014 at 11:15

1 Answer 1

1

By reading the documentation at http://mapserver.org/cgi/controls.html for rendering several layers with Mapserver CGI you need to give a comma separated list of layers or use LAYERS=all. Perhaps Mapserver takes only the first occasion of &layer from your request.

LAYERS [name name ...] The names of the layers to be turned on. Layer names must be seperated by spaces. Version 4.4 and above: passing ‘LAYERS=all’ will automatically turn on all layers.

Mapfiles generated by QGIS does not generate valid mapfiles nowadays. Without editing them they do not work at all for WMS and other OGC services. There exists new alternatives map editing but I have not tested them myself: MapManager for Windows users http://blog.gisinternals.com/2014/02/announcing-mapserver-mapmanager-10.html and Scribeui https://github.com/mapgears/scribeui

You can now try ScribeUI using a docker container (https://hub.docker.com/r/christianbeland/scribeui-docker/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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