Content Dependent Legend Rendering Tracking (RFC 101) #4713

Closed
wants to merge 9 commits into
from

Projects

None yet

5 participants

@tbonfort
Member

Track development around rfc101: http://mapserver.org/development/rfc/ms-rfc-101.html

@tbonfort tbonfort was assigned Jul 24, 2013
@tbonfort tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Jul 25, 2013
@tbonfort tbonfort Add tests for content dependant legend rendering (RFC101) ed9b697
@tbonfort
Owner

@sdlime, can you have a quick check to confirm that I'm doing things right here? aim is to be able to pass &map.legend.label=font+arial kind of parameters.
thanks,
thomas

I think this change is correct. I wonder if we should require validation for a font if the token source is a URL in loadLabel though. Typically I was doing that if there wasn't already some sort of parser validation (e.g. number).

Owner

I'm not sure we need a validation, you're not supplying a direct path to a font file, but an entry in the fontset hashtable, so the worst that can happen is just a failed font lookup, no ?

Owner
@tbonfort tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Jul 26, 2013
@tbonfort tbonfort Add tests for content dependant legend rendering (RFC101) 7593cf1
@tbonfort tbonfort added a commit that referenced this pull request Jul 26, 2013
@tbonfort tbonfort Implementation of RFC101 content dependant legend rendering (#4713)
adds cgi modes maplegend and maplegendicon
allow changing legend label by url
471cdf4
@tbonfort
Member

rebased and applied in 471cdf4, closing

@tbonfort tbonfort closed this Jul 27, 2013
@tbonfort tbonfort deleted the tbonfort:getlegendgrahic-content-dependant branch Jul 27, 2013
@tmcw
tmcw commented Sep 2, 2013

(in this usage, isn't it dependent, not dependant?)

@tbonfort
Member
tbonfort commented Sep 2, 2013

@tmcw, yet another reason to us US english only :) - fixed, thanks

@luca76
luca76 commented Dec 2, 2014

Sorry for writing here. The CGI mode MAPLEGEND isn't documented, but as I have understand, it should return content based HTML template legend. But If I use:

http://local/cgi-bin/mapserv?map=map.map&mode=maplegend&MAPEXT=X1 Y1 X2 Y2&SRS=EPSG:25832

it always returns a empty legend... am I missing some other parameter?

@tbonfort
Member
tbonfort commented Jan 4, 2016

@ruhri can you provide a gdb backtrace of the crash, or a complete testcase that would allow me to reproduce this

@ruhri
ruhri commented Jan 6, 2016

Hi tbonfort, thank you for your efforts.
Further investigation becomes more strange:
I like to use "Named group layers" as stated in http://mapserver.org/development/rfc/ms-rfc-75.html#named-group-layers.
mapfile-example: https://svn.osgeo.org/mapserver/sandbox/inspire_soc2011/msautotest/wxs/wms_inspire.map

my personal simplified case -which leads to the above posted segfault problem - is the following layer structure (it shows public transportation lines...):

# Gruppenlayer: ÖPNV
LAYER
    NAME "oepnv"
    METADATA
        "ows_srs"                               "EPSG:25832 EPSG:25833 EPSG:3857 EPSG:4258 EPSG:4326 EPSG:31466 EPSG:31467 EPSG:31468 EPSG:31469 EPSG:900913"
        "ows_extent"                            "300000.0 5620000.0 440000.0 5770000.0"
        "ows_title"                             "ÖPNV"
        "ows_abstract"                          "Ebene ÖPNV"
    END
    TYPE POINT
END

# Layer: ÖPNV-Liniennetz
LAYER
    NAME "oepnv_linien"
    DATA "/data/spw/spw_web/oepnv/linien"

    METADATA
        "wms_enable_request"                    "*"
        "wfs_enable_request"                    "*"
        "wfs_getfeature_formatlist"             "gml2,gml3,shapezip,csv,geojson,gpx"
        "ows_srs"                               "EPSG:25832 EPSG:25833 EPSG:3857 EPSG:4258 EPSG:4326 EPSG:31466 EPSG:31467 EPSG:31468 EPSG:31469 EPSG:900913"
        "ows_extent"                            "300000.0 5620000.0 440000.0 5770000.0"
        "wms_layer_group"                       "/oepnv"
        "ows_title"                             "ÖPNV-Liniennetz"
        "ows_abstract"                          "Ebene ÖPNV-Liniennetz"
        "gml_featureid"                         "gid"
        "gml_include_items"                     "all"
        "gml_geometries"                        "geom"
        "gml_geom_type"                         "multiline"
        "gml_verkehrsm_alias"                   "verkehrsmittel"
    END

    TYPE LINE

    PROJECTION
        "init=epsg:25832"
    END

    MAXSCALEDENOM 501000
    MINSCALEDENOM 1

    UNITS METERS
    CLASSITEM 'verkehrsm'
    CLASS
        NAME "Bus"
        EXPRESSION 'Bus'
        STYLE
            WIDTH 1.5
            COLOR 0 170 50
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 0.5
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "Straßenbahn"
        EXPRESSION 'Straßenbahn'
        STYLE
            WIDTH 2.2
            COLOR 204 0 0
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 0.7
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "Stadtbahn"
        EXPRESSION 'Stadtbahn'
        STYLE
            WIDTH 3.0
            COLOR 21 106 184
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 1
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "U-Bahn"
        EXPRESSION 'U-Bahn'
        STYLE
            WIDTH 3.0
            COLOR 21 106 184
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 1
            LINEJOIN ROUND
        END
    END
END

MAPFILE VERSION2:
if I just move the named group below it's sublayer in the mapfile (the only change!!!), the content dependent legend works well now:

# Layer: ÖPNV-Liniennetz
LAYER
    NAME "oepnv_linien"
    DATA "/data/spw/spw_web/oepnv/linien"

    METADATA
        "wms_enable_request"                    "*"
        "wfs_enable_request"                    "*"
        "wfs_getfeature_formatlist"             "gml2,gml3,shapezip,csv,geojson,gpx"
        "ows_srs"                               "EPSG:25832 EPSG:25833 EPSG:3857 EPSG:4258 EPSG:4326 EPSG:31466 EPSG:31467 EPSG:31468 EPSG:31469 EPSG:900913"
        "ows_extent"                            "300000.0 5620000.0 440000.0 5770000.0"
        "wms_layer_group"                       "/oepnv"
        "ows_title"                             "ÖPNV-Liniennetz"
        "ows_abstract"                          "Ebene ÖPNV-Liniennetz"
        "gml_featureid"                         "gid"
        "gml_include_items"                     "all"
        "gml_geometries"                        "geom"
        "gml_geom_type"                         "multiline"
        "gml_verkehrsm_alias"                   "verkehrsmittel"
    END

    TYPE LINE

    PROJECTION
        "init=epsg:25832"
    END

    MAXSCALEDENOM 501000
    MINSCALEDENOM 1

    UNITS METERS
    CLASSITEM 'verkehrsm'
    CLASS
        NAME "Bus"
        EXPRESSION 'Bus'
        STYLE
            WIDTH 1.5
            COLOR 0 170 50
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 0.5
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "Straßenbahn"
        EXPRESSION 'Straßenbahn'
        STYLE
            WIDTH 2.2
            COLOR 204 0 0
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 0.7
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "Stadtbahn"
        EXPRESSION 'Stadtbahn'
        STYLE
            WIDTH 3.0
            COLOR 21 106 184
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 1
            LINEJOIN ROUND
        END
    END
    CLASS
        NAME "U-Bahn"
        EXPRESSION 'U-Bahn'
        STYLE
            WIDTH 3.0
            COLOR 21 106 184
            OUTLINECOLOR 255 255 255
            OUTLINEWIDTH 1
            LINEJOIN ROUND
        END
    END
END

# Gruppenlayer: ÖPNV
LAYER
    NAME "oepnv"
    METADATA
        "ows_srs"                               "EPSG:25832 EPSG:25833 EPSG:3857 EPSG:4258 EPSG:4326 EPSG:31466 EPSG:31467 EPSG:31468 EPSG:31469 EPSG:900913"
        "ows_extent"                            "300000.0 5620000.0 440000.0 5770000.0"
        "ows_title"                             "ÖPNV"
        "ows_abstract"                          "Ebene ÖPNV"
    END
    TYPE POINT
END

second strange thing:
If I duplicate the "public transportation lines"-layer in the same mapfile (MAPFILE VERSION 2) and change it's name to "NAME "oepnv_linien2" I have a second layer in my service - from that point nothing magic. standard-getlegend against that layer also works well; content dependent legend doesn't produce an error, but just shows the labels in the legend and NOT the legendsymbols... ???
This also happens, if I remove the the group-structure (delete named group layer "oepnv" and "wms_layer_group" keywords from the other layers completely).

default legend:
spw_web2

content dependent legend (MAPFILE VERSION 2):
spw_web3

content dependent legend - oepnv_linien2 (added to MAPFILE VERSION 2):
spw_web4

@tbonfort
Member
tbonfort commented Jan 6, 2016

can you (privately) send me the data + full mapfile to reproduce this locally please

@ruhri
ruhri commented Jan 6, 2016

Hi Thomas,
send it to 'thomas.bonfort@gmail.com'

@tbonfort
Member
tbonfort commented Jan 6, 2016

@ruhri can you try with d02e6fb (applied to branch-7-0)

@ruhri
ruhri commented Jan 6, 2016

works well in my scenario, now!!!

THUMBS UP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment