[mapserver-users] Dual role of LAYER is confusing

thomas bonfort thomas.bonfort at gmail.com
Mon Feb 10 08:03:27 PST 2014


On 10 February 2014 15:13, Rahkonen Jukka  (Tike)
<jukka.rahkonen at mmmtike.fi> wrote:
> 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.

Supposing you had that use-case given your data files, how would you
specify it in a more readable way if you didn't have this syntax?

>
> 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"

I'd argue that referencing an existing layer is less confusing. In any
case it is more powerfull, more flexible and more maintainable in our
codebase.

Interesting points nevertheless....

best regards,
thomas

>
> -Jukka Rahkonen-
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list