[mapserver-users] FILTER and multi STYLE tags
Kalbermatten Michaël
Michael.Kalbermatten at ne.ch
Thu Jan 16 23:27:33 PST 2020
Dear all,
We have quite a strange filter behavior.
We have a layer (relying on PostGIS data and with multine geometries) containing several classes with some of them having multiple STYLE tags. Something like:
CLASS
NAME "Ouvrages d'art"
EXPRESSION "Ouvrages d'art"
STYLE
COLOR 255 141 0
WIDTH 8
LINECAP butt
END
END
CLASS
NAME "OFROU"
EXPRESSION "OFROU"
STYLE
COLOR 255 0 0
WIDTH 8
LINECAP butt
END
STYLE
COLOR 255 141 0
WIDTH 2
LINECAP butt
END
END
CLASS
NAME "CFF"
EXPRESSION "CFF"
STYLE
COLOR 35 35 35
WIDTH 3
LINECAP butt
END
STYLE
COLOR 35 35 35
SYMBOL "barre"
SIZE 12
GAP -10
END
END
A WMS request on this layer will renderer all objects regarding their class, which is the expected behavior.
Now, a FILTER tag is applied on this layer, a request which would look like:
http://myserver.com/my_mapserver_cgi?SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&FORMAT=image/png
&TRANSPARENT=true
&LAYERS=rt55_chantiers_futurs
&STYLES=
&FILTER=(<Filter xmlns="http://www.opengis.net/ogc"><PropertyIsBetween><PropertyName>annee_debut</PropertyName><LowerBoundary><Literal>2021</Literal></LowerBoundary><UpperBoundary><Literal>2021</Literal></UpperBoundary></PropertyIsBetween></Filter>)
&CRS=EPSG:2056
&WIDTH=1925
&HEIGHT=936
&BBOX=2503325,1194925,2599575,1222975
(I removed the URL escaping and made it multiline for readability)
This request generates something really strange. Returned features from the server are rendered until Mapserver encounters the first feature which corresponds to a class having more than one STYLE tag. All other features (coming next regarding the request sent to the PostGIS server) are not rendered any more. Mapserver does not trigger any error, nor does the database. In the mapserver logs:
[Wed Jan 15 08:03:11 2020].640000 CGI Request 1 on process 4228
[Wed Jan 15 08:03:11 2020].649000 FLTLayerApplyPlainFilterToLayer(): ("[annee_debut]" ~* ".*2021.*"), rect=2503325,1194925,2599575,1222975
[Wed Jan 15 08:03:11 2020].658000 msDrawMap(): rendering using outputformat named png (AGG/PNG).
[Wed Jan 15 08:03:11 2020].658000 msDrawMap(): WMS/WFS set-up and query, 0.000s
[Wed Jan 15 08:03:11 2020].658000 msDrawMap(): Layer 917 (rt55_chantiers_futurs), 0.000s
[Wed Jan 15 08:03:11 2020].658000 msDrawMap(): Drawing Label Cache, 0.000s
[Wed Jan 15 08:03:11 2020].658000 msDrawMap() total time: 0.003s
[Wed Jan 15 08:03:11 2020].709000 msSaveImage(stdout) total time: 0.051s
[Wed Jan 15 08:03:11 2020].709000 mapserv request processing time (msLoadMap not incl.): 0.069s
[Wed Jan 15 08:03:11 2020].709000 msFreeMap(): freeing map at 00000258E99A8030.
After playing with the Mapfile and related data for a few hours, we discovered that because we analyzed the following elements :
- The feature order in the database
- The STYLE tags in the mapfile classes: making all classes having only one STYLE tag
Thus, if a use these classes:
CLASS
NAME "Ouvrages d'art"
EXPRESSION "Ouvrages d'art"
STYLE
COLOR 255 141 0
WIDTH 8
LINECAP butt
END
END
CLASS
NAME "OFROU"
EXPRESSION "OFROU"
STYLE
COLOR 255 0 0
WIDTH 8
LINECAP butt
END
END
CLASS
NAME "CFF"
EXPRESSION "CFF"
STYLE
COLOR 35 35 35
WIDTH 3
LINECAP butt
END
END
Then everything works as expected (using a filter tag in the request), and all features are rendered by Mapserver.
Moreover it is not a DB issue, because if you send a WFS request using exactly the same layer definition and the same filter to Mapserver, then everything is working as expected (all expected features are returned).
This really looks like some kind of rendering issue combined to filtering.
Any hints or thoughts on that ?
Best regards
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20200117/9cbeb20c/attachment.htm>
More information about the MapServer-users
mailing list