2

I am developing a web mapping application based on OpenLayers and using a WMS layer from MapServer (the source data for this layer is stored in PostGIS database) and I am facing the following problem: MapServer eliminates a lot of features at the lowest zoom levels.

Zoom Level 10: Zoom Level 10

Zoom Level 7: Zoom Level 7

Zoom Level 5:
Zoom Level 5

Zoom Level 4:
Zoom Level 4

Zoom Level 3:
Zoom Level 3

I guess it is because MapServer doesn't display features with area less than one pixel. Is it possible to render such features at lowest zoom levels (for example as one pixel features)?

UPD.: I'm talking about orange features, green ones - it is part of OSM tiles.

Here is my mapfile:

MAP
SIZE 800 600
MAXSIZE 4096

IMAGECOLOR 255 255 255
IMAGETYPE PNG

OUTPUTFORMAT
    NAME "png"
    EXTENSION "png"
    MIMETYPE "image/png"
    DRIVER AGG/PNG
    IMAGEMODE RGBA
    FORMATOPTION "INTERLACE=OFF"
END

EXTENT -180 -90 180 90
PROJECTION
    "init=epsg:4326"
END

WEB
    METADATA
        wms_onlineresource "${request.route_url('mapserver.ows')}"
        wfs_onlineresource "${request.route_url('mapserver.ows')}"
        ows_title "mcx_pk"
        wms_enable_request "*"
        # ows_service_onlineresource  "${request.route_url('mapserver.ows')}"
        wms_srs "epsg:4326 epsg:3857 epsg:900913"
    END
END

LAYER
    NAME "fields"
    CONNECTION "user=pk password=******* dbname=pk host=***.info"
    CONNECTIONTYPE postgis
    PROCESSING "CLOSE_CONNECTION=DEFER"
    DATA "wkb_geometry from mask_f using unique ogc_fid using srid=4326"
    TYPE line
    DUMP TRUE
    TEMPLATE dummy.html
    PROJECTION
        "init=epsg:4326"
    END
    EXTENT -180 -90 180 90
    METADATA
        gml_include_items   "all"
        wms_include_items   "all"
    END
    CLASS
        STYLE
            COLOR 255 136 0
        END
    END
END
4
  • I think you should clarify your question by pointing out the features in your map that are not drawn (and should be). I.e.: by looking at the images one does not understand whether you're talking about the orange or green ones.
    – unicoletti
    Commented Dec 26, 2011 at 21:39
  • Ok, I've modified my question.
    – drnextgis
    Commented Dec 26, 2011 at 23:53
  • thanks, do you think you can share the map file? It might have to do with scale-dependent rendering (ie layers hidden at certain scales)
    – unicoletti
    Commented Dec 27, 2011 at 7:32
  • I've shared part of my mapfile which contains layer description.
    – drnextgis
    Commented Dec 27, 2011 at 8:07

4 Answers 4

2

Try adding WIDTH 1 to your STYLE block.

1
  • While I have no problem with gis.stackexchange, you will get much better support by posting mapserver related questions to the mapserver mailing list. Commented Dec 30, 2011 at 18:25
2

You could try creating a new POINT layer of the feature centroids, and set this layer to be visible when zoomed out.

You could then also use the new CLUSTERING functions when points are too close together.

2

Undocumented feature fixed my problem:

  PROCESSING "APPROXIMATION_SCALE=FULL"

For more details see ticket #4143

1

OKay so what you need is to use SLD (Styled Layer Descriptors ). These are basicaly xml structured files where you can specify the design and control the rendering of a wms layer. IN context of your question, you can specify which fetures to render at which zoom level. So for the road network layer, in its sld you can specify at which zoom levels you want to render this layer. check this out:

http://mapserver.org/ogc/sld.html

2
  • I'm not sure SLD can help me, because I have features at all zoom levels, but at the lowest zoom levels MapServer doesn't draw many of them.
    – drnextgis
    Commented Dec 27, 2011 at 5:43
  • from sld you can make those one pixel features render larger may be assigning image icon (just suggestion) or you can represent the point with more pixels. also you decide pixel sizes on each zoom level.
    – Shaunak
    Commented Dec 27, 2011 at 6:22

Your Answer

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

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