Unable to pass FEATURE ITEMS from URL #5335

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@itt-de
itt-de commented Oct 12, 2016

We tried to pass a FEATURE via a URL parameter. This works perfectly for attributes WKT and TEXT of the FEATURE.
It doesn't seem to work for attribute ITEMS.

Example:

Layer definition in Mapfile:

LAYER
    NAME testLayer
    TYPE polygon
    STATUS on
    METADATA
       WMS_TITLE "TestLayer"
       WMS_SRS "EPSG:31468"
    END
    PROCESSING "ITEMS=zaehljahr"
    CLASSITEM "zaehljahr"
    CLASS
      EXPRESSION '0'
      NAME "0"
      STYLE
        OPACITY 60
    COLOR 0 255 0
    ANTIALIAS FALSE
      END
      TEXT "[zaehljahr]"
      LABEL
        TYPE truetype
        COLOR 255 255 255
        FONT arial
        SIZE 12
        ANTIALIAS false
        POSITION lc
        PARTIALS false
        BUFFER 0
      END
    END
    CLASS
      EXPRESSION '1'
      NAME "1"
      STYLE
        OPACITY 60
    COLOR 0 221 0
    ANTIALIAS FALSE
      END
      TEXT "[zaehljahr]"
      LABEL
        TYPE truetype
        COLOR 255 255 255
        FONT arial
        SIZE 12
        ANTIALIAS false
        POSITION lc
        PARTIALS false
        BUFFER 0
      END
    END
END

Request-URL:
http://localhost/cgi-bin/mapserv.fcgi?map=test.map&VERSION=1.1.1&LAYERS=testLayer&BBOX=4548756.4916980425,5451024.760221503,4548993.064391087,5451261.332914547&WIDTH=300&HEIGHT=300&SRS=EPSG:31468&FORMAT=image/png&STYLES=&TRANSPARENT=FALSE&SERVICE=WMS&REQUEST=GetMap&map.layer[testLayer]=FEATURE WKT "MULTIPOLYGON (((4548889.74 5451201.12, 4548897.895232 5451196.8590681, 4548903.707732 5451211.3590681, 4548925.645232 5451208.3590681, 4548919.020232 5451190.1715681, 4548932.21 5451186.42, 4548903.68 5451193.28, 4548889.74 5451201.12)))" ITEMS "1" END

Error-Message:

loadfeature(): Unknown identifier. Parsing error near (ITEMS):(line 1)

Thanks for looking into this.

@tbonfort
Member

what mapserver version?

@itt-de
itt-de commented Oct 12, 2016

We tried version 7.0.1 and 6.4.1 with the same result.

@tbonfort tbonfort Allow FEATURE->ITEMS to be set by URL (#5335)
04cd3ac
@tbonfort
Member

Attached patch should resolve the issue. Please confirm.

@sdlime
Member
sdlime commented Oct 12, 2016

Since this input is so arbitrary I think we need to also update mapfile.c around line 950 to require a validation entry so it's not enabled by default. --Steve

@sdlime sdlime closed this Oct 12, 2016
@sdlime sdlime reopened this Oct 12, 2016
@tbonfort
Member

@sdlime validation should be for whole FEATURE, not just ITEMS? (I mean, changing/setting the geometry is just as dangerous as changing just the items)

@sdlime
Member
sdlime commented Oct 12, 2016

You can't change anything about a feature and can only add them. Anyway, the the parser for the geometry portion of a feature already does specific validation (e.g. is a value a number or valid WKT), I'd think that's sufficient.

@itt-de
itt-de commented Oct 13, 2016

Many thanks for the fast fix. Unfortunately I don't have any build-infrastructure, so I cant't confirm until the next official release. We will certainly make good use of this in future.

@tbonfort
Member
tbonfort commented Dec 5, 2016

applied to branch-7-0 in 93cc1ed

@tbonfort tbonfort closed this Dec 5, 2016
@tbonfort tbonfort deleted the tbonfort:issues/5335-items-by-url branch Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment