[MapServer-users] Is it possible to pass variables to a mapfile DATA parameter?

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Wed Mar 8 23:47:24 PST 2023


Hi,

I think that your question belongs rather to OpenLayers forums. On the Mapserver side you can use run-time substitution in LAYER-DATA https://mapserver.org/cgi/runsub.html#parameters-supported.
DATA "geom FROM %table% USING srid=32636 USING UNIQUE fid"

What OpenLayers need to do is to add “&table=xxyy” to the GetFeature requests.

-Jukka Rahkonen-



Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Neil Underhill
Lähetetty: keskiviikko 8. maaliskuuta 2023 23.47
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: [MapServer-users] Is it possible to pass variables to a mapfile DATA parameter?

Hi all,

I am using mapserver to allow WFS in Openlayers to access point data held in a PostgreSQL / PostGIS database. The mapfile includes the following statement:

...
INCLUDE "readonly.config"
DATA "geom FROM table USING srid=32636 USING UNIQUE fid"
...

Currently I make a new mapfile for each site visit to each project. However this means every time a new site visit or project is made, I have to create a new mapfile, and the only thing that changes is the "table" part of the statement. All the styling info is in the Openlayers WFS statements.

Is it possible to get Openlayers to pass variables to the DATA parameter (e.g. a different table name) when called so that I can reuse the same mapfile for different WFS calls?
Or alternatively, could store the point data in the same PostgreSQL table and have some other way of filtering the data (e.g. on timestamp)
Am I misunderstanding how I should be using mapfiles?

thanks,
Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230309/d7904233/attachment.htm>


More information about the MapServer-users mailing list