.. _query-as:
How-to display a raster layer and query as a vector layer
=========================================================
Raster services have limitations. WMS can only support a point-based
query and not polygon or attribute based queries. However, vector layers
can be more complicated to style and less consistently displayed between
different clients. GeoMoose provides a way to have services
automatically refer to a vector layer for query operations when using a
raster layer.
An example with parcels
-----------------------
This is a cut down example based on the layers in the desktop demo's
mapbook:
.. code:: xml
./demo/parcels/parcels.map
]]>
./demo/parcels/parcels.map
How this is processed internally
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The parcels layer is served as WMS. But if you look at the
```` it has a query-as attribute set to
``vector-parcels/parcels``. So a few things happen:
1. When the Select service goes to execute a query, it looks for layers with a template
which has the name attribute set to ``select``. The ``parcels/parcels`` layer will
not have one but because its query-as attribute is set to
``vector-parcels/parcels`` it will look for a 'select' template there
first. It will find the template there and then use
``vector-parcels/parcels`` (WFS) instead of ``parcels/parcels`` (WMS) to
execute the select query.
2. When the Identify service goes to execute a
query, it will NOT find the identify template in
``vector-parcels/parcels`` but WILL find it in parcels/parcels and use
WMS to execute that query.
Only ``parcels/parcels`` needs to be turned on! GeoMoose will
automatically pick the best source with which to perform the query.
Other notes
~~~~~~~~~~~
The query-as also accepts a list of paths like in the catalog. It could
be possible to refer to multiple vector sources for querying. Or even
other raster sources for identify-queries.
AGS mapsources can also use the above "query-as" technique to allow query
operations. In this case the target of the query-as could be a ags-vector mapsource.