1

This is what my mapserver layer in the map file looks like:

LAYER
    NAME "blah"
    CONNECTIONTYPE postgis
    CONNECTION "user=apache dbname=blah"
    PROCESSING "CLOSE_CONNECTION=DEFER"
    DATA "the_geom from (select  gid, ST_Transform(the_geom, 4326) as the_geom from public.test_blah_4326 limit 20) as subquery using unique gid using srid=4326"
    STATUS ON
    TYPE LINE
    PROJECTION
        "init=epsg:32007"
    END
    DUMP true
    METADATA
        "wms_title" "blah"
        "wms_srs" "epsg:4326 epsg:900913"
        "wms_feature_info_mime_type" "text/html"
    END
    CLASS
        NAME "platform_loc"
        STYLE
            OUTLINECOLOR 254 0 0
            WIDTH 1
        END
    END
END

The contours show up. It works. But there are so many contour lines that it just looks like a big blob on the screen.

What's the best way to "thin out" the number of contour lines based on what you're looking / how far you are zoomed in leaflet (zoom / elevation)?

I saw an attribute of the layer called PROCESSING that might help me, however, the docs aren't helpful in understanding exactly how to use it, or if it's even applicable to what I'm trying to do.

1

You need to perform some kind of map generalization. You may have two possibilities:

1) Generalize your data prior serving it to mapserver: Use a desktop GIS or some GIS library to generalize your data. In your case, if you need to select, e.g., one contour line on two, you probably don't need a map generalization algorithm but just a smart selection of your contour lines based on their values. For instance, if you want to remove all contour lines with 5 meters as a precision, you just have to select contour lines with a 10 meters precision. Then save your generalized data. Without having your data, I'm just speculating. You have to think about the way you'll generalize.

2) Generalize your data within mapserver via the postgis connection: Since you are using a postgis connection, try to find a way to select your data by changing the postgis connection (See the SCALETOKEN examples of http://mapserver.org/mapfile/layer.html if you don't see what I mean).

Whatever option you use, you have then to display the generalized layer and hide the non-generalized layer at a certain level of zoom using MINSCALEDENOM and MAXSCALEDENOM parameters in the map file. Of course, you can make several degree of generalization.

Hope it helps

J.

PS: the GEOMTRANSFROM parameter does some kind of on-the-fly generalization, but in your case, for contour lines, you'd better make a simple selection of your data.

Your Answer

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