[mapserver-users] Dual role of LAYER is confusing
Rahkonen Jukka (Tike)
jukka.rahkonen at mmmtike.fi
Mon Feb 10 06:13:50 PST 2014
Hi,
In most cases in Mapfile LAYER is defining the output of the service. However, it looks like the original way to use DATA has not been flexible enough to suit new sources of data and as a workaround one layer is used as an input for another layer. For example if a shapefile is used as tileindex it is enough to write TILEINDEX "tiger/index.shp"
However, if one wants to take tileindex from Spatialite it must be done by defining a layer first
LAYER # The tileindex layer
NAME "spatialite_tileindex"
STATUS OFF
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION "/orthophotoindex.sqlite"
DATA "select * from orthophotos where year=2013"
PROJECTION
"init=epsg:3067"
END
END # End of tileindex layer
LAYER # The orthophoto layer
NAME "orthophotos_2013 "
STATUS ON
TILEINDEX "spatialite_tileindex" # Name of the tileindex layer
....
I guarantee that many if not all new Mapserver users consider this as tricky. However, situation can be even more tricky. The new RFC about heatmaps/density maps gives an example http://mapserver.org/development/rfc/ms-rfc-108.html.
The source data for the heatmap layer is configured as
LAYER
NAME "heatmap"
TYPE raster
CONNECTIONTYPE kerneldensity
CONNECTION "points"
and here "points" is referring to a layer. It the "points" layer is using ogrtileindex where tileindex is not a shapefile but comes from a database we will need three layers for publishing the heatmap:
- ogrtileindex layer
- "points" layer
- heatmap layer
This is doable but confusing. What is also confusing is that I have not yet found a way to hide those technical layers from WMS.
Until now after making a web search during a coffee break, it is naturally done with a layer level metadata item "ows_enable_request" "!*" as described in http://mapserver.org/de/development/rfc/ms-rfc-67.html. Great. But still I feel the dual role of "layer" a bit confusing. At least in the tileindex case I wish I could simply write just one line even if with somehow complicated syntax. Perhaps it could be something like
TILEINDEX "SELECT * from orthophotos where year=2013 USING OGR CONNECTION /orthophotoindex.sqlite"
-Jukka Rahkonen-
More information about the MapServer-users
mailing list