New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Dependent Legend Rendering Tracking (RFC 101) #4713

Closed
wants to merge 9 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@tbonfort
Member

tbonfort commented Jul 24, 2013

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

@ghost ghost assigned tbonfort Jul 24, 2013

tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Jul 25, 2013

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jul 25, 2013

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

Owner

tbonfort commented on mapfile.c in d501f90 Jul 25, 2013

@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

This comment has been minimized.

Show comment
Hide comment
@sdlime

sdlime Jul 26, 2013

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).

sdlime replied Jul 26, 2013

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).

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jul 26, 2013

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 replied Jul 26, 2013

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 ?

This comment has been minimized.

Show comment
Hide comment
@sdlime

sdlime Jul 26, 2013

sdlime replied Jul 26, 2013

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jul 26, 2013

Owner
Owner

tbonfort replied Jul 26, 2013

tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Jul 26, 2013

tbonfort added a commit that referenced this pull request Jul 26, 2013

Implementation of RFC101 content dependant legend rendering (#4713)
adds cgi modes maplegend and maplegendicon
allow changing legend label by url
@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jul 27, 2013

Member

rebased and applied in 471cdf4, closing

Member

tbonfort commented Jul 27, 2013

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

This comment has been minimized.

Show comment
Hide comment
@tmcw

tmcw Sep 2, 2013

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

tmcw commented Sep 2, 2013

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

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Sep 2, 2013

Member

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

Member

tbonfort commented Sep 2, 2013

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

@luca76

This comment has been minimized.

Show comment
Hide comment
@luca76

luca76 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?

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?

@ruhri

This comment has been minimized.

Show comment
Hide comment
@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jan 4, 2016

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@ruhri

ruhri 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

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

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jan 6, 2016

Member

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

Member

tbonfort commented Jan 6, 2016

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

@ruhri

This comment has been minimized.

Show comment
Hide comment
@ruhri

ruhri Jan 6, 2016

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

ruhri commented Jan 6, 2016

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

tbonfort added a commit that referenced this pull request Jan 6, 2016

@tbonfort

This comment has been minimized.

Show comment
Hide comment
@tbonfort

tbonfort Jan 6, 2016

Member

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

Member

tbonfort commented Jan 6, 2016

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

@ruhri

This comment has been minimized.

Show comment
Hide comment
@ruhri

ruhri Jan 6, 2016

works well in my scenario, now!!!

THUMBS UP

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