[QGIS-Developer] QGIS Server request extra parameters as variables for expressions

Arnaud Morvan arnaud.morvan at camptocamp.com
Thu Nov 23 07:46:57 PST 2017


@Patrick :

Yes, I know that it is possible to use FILTER in request, but I'm not 
sure all layers will have the same field name for "floor".

So I would prefer to define a filter in each layer definition in the 
project file using a common variable name.

And I would like to have the same behavior on desktop side (using a UI 
plugin that set the variable value and refresh the canvas).

@Mathias :

Yes after taking a look, WMS dimensions is exactly the idea I have in mind.

In mapserver documentation about WMS dimension I see that the dimension 
field is defined in each layer.

LAYER
   NAME  "lakes_elev"
   METADATA
     "wms_title"          "Lakes"
     "wms_description"    "Lakes"
     "wms_dimensionlist"  "elevation, text_dimension"
     "wms_elevation_item"  "ELEV"
     "wms_elevation_extent"  "500, 490, 480"
     "wms_elevation_units"  "meters"
     "wms_elevation_default"  "500"
     "wms_text_dimension_item"  "text_dimen"
     "wms_text_dimension_extent"  "first, second, third"
      "wms_text_dimension_units"  "my_units"
      "wms_enable_request"  "*"
   END
   TYPE  POLYGON
   ..

END


Is there something about WMS dimensions in QGIS server roadmap ?


For now we do it in mapserver using normal template variables, for 
example :

LAYER

VALIDATION

         "floor" "[+-][0-9A]+"'

     END

     DATA "geom FROM (SELECT * FROM mytable WHERE etage = '%floor%' OR 
etage IS NULL OR '%floor%' = 'NULL') AS foo USING UNIQUE id USING srid=3945"

END

Note that here the default is no filter at all (all features displayed 
when the parameter is missing), and features with etage == NULL are 
displayed on all floors.

Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 58 48 20 32

Camptocamp France SAS
18 rue du Lac Saint André
Savoie Technolac - Bâtiment Le Dauphin
F-73370 Le Bourget du Lac
http://www.camptocamp.com

Le 23/11/2017 à 14:49, Patrick Valsecchi a écrit :
> You could do that using the filter parameter with something like that:
> FILTER=layer_name:"floor" = 3
>
> On Thu, Nov 23, 2017 at 2:38 PM, Matthias Kuhn <matthias at opengis.ch 
> <mailto:matthias at opengis.ch>> wrote:
>
>     Like WMS dimension?
>
>     http://mapserver.org/ogc/wms_dimension.html
>     <http://mapserver.org/ogc/wms_dimension.html>
>
>     Matthias
>
>
>     On 11/23/17 2:11 PM, Arnaud Morvan wrote:
>     > Hello,
>     >
>     > I would like GetMap and GetFeature request extra parameters to be
>     > accessible as variables in server.
>     >
>     > So we could define, in QGIS project, a variable "floor", used to
>     > filter layers.
>     >
>     > On desktop side, we could have a desktop plugin named FloorSlider to
>     > change the "floor" value.
>     >
>     > And on the server side, the floor value could be passed as extra
>     > parameter.
>     >
>     > So it would be easy to handle multi-floor layers in a project file.
>     >
>     >
>     > Arnaud Morvan
>     > Ingénieur logiciel
>     > Tél: +33 (0)4 58 48 20 32 <tel:%2B33%20%280%294%2058%2048%2020%2032>
>     >
>     > Camptocamp France SAS
>     > 18 rue du Lac Saint André
>     > Savoie Technolac - Bâtiment Le Dauphin
>     > F-73370 Le Bourget du Lac
>     > http://www.camptocamp.com
>     >
>     > Le 22/11/2017 à 18:05, René-Luc Dhont a écrit :
>     >> Hi Arnaud,
>     >>
>     >> Is it like updated a QGIS project variables ?
>     >>
>     >> Regards,
>     >>
>     >> René-Luc
>     >>
>     >>
>     >> Le 22/11/2017 à 15:31, Arnaud Morvan a écrit :
>     >>> Hello,
>     >>>
>     >>> With mapserver, request extra parameters are accessible as
>     template
>     >>> variables in mapfile.
>     >>>
>     >>> I would like to implement the same possibility in QGIS Server,
>     extra
>     >>> parameters may be accessible in project as expression variables.
>     >>>
>     >>> For example : I would like to pass in a GetMap request an extra
>     >>> parameter FLOOR.
>     >>>
>     >>> This parameter could be handled by QGIS Server as a variable
>     value,
>     >>> so this could be used in the project to filter some layers
>     using an
>     >>> expression.
>     >>>
>     >>> Do you think this could be acceptable directly in QGIS Server, or
>     >>> may I have to wrote a plugin.
>     >>>
>     >>> Maybe this type of plugin already exists ?
>     >>>
>     >>> Note that I'm not familiar with server part.
>     >>>
>     >>> Best regards
>     >>>
>     >>
>     >> _______________________________________________
>     >> QGIS-Developer mailing list
>     >> QGIS-Developer at lists.osgeo.org
>     <mailto:QGIS-Developer at lists.osgeo.org>
>     >> List info:
>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     >> Unsubscribe:
>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     >
>     > _______________________________________________
>     > QGIS-Developer mailing list
>     > QGIS-Developer at lists.osgeo.org
>     <mailto:QGIS-Developer at lists.osgeo.org>
>     > List info:
>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     > Unsubscribe:
>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     >
>
>     _______________________________________________
>     QGIS-Developer mailing list
>     QGIS-Developer at lists.osgeo.org <mailto:QGIS-Developer at lists.osgeo.org>
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     Unsubscribe:
>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171123/840476c7/attachment-0001.html>


More information about the QGIS-Developer mailing list