1

In Mapserver it is possible to set a variable when connecting to postGIS. This way I have created an fill-in form where you can enter a postcode and then you get a result.

How can do this with putting a runtime variable in the Mapserver. Like this:

DATA "geom from (select t1.geom from schemaname.tablename t1 where t1.code = '%code%') as selectie using unique code using srid=28992"

In the html / openlayers script you can refer to what is between the % %.

Now I want to make a selection tool for querying a different schema and table. So you have an input where you fill in a schemaname and tablename and then you get a result from that table.

I thought that it would be something like this:

DATA "geom from (select t1.geom, from %schemaname%.%tablename%) as selectie using unique code using srid=28992"

Unfortunately this is not working. Does someone know whether this is possible and how I can make this work.

2 Answers 2

1

As far as I know, it not possible with MapServer.

I would try I different approach, using the WMS GetFeatureInfo request, which is intended for information retrieving like the one you mention at the beginning of your question.

MapServer implements this request. On client side, OpenLayers has a control, also named GetFeatureInfo, that makes easier using this request.

1
  • Thanks! Too bad it is not possible. Do you know how I can make it work with the GetFeatureInfo request? What I want is not retrieving information, but I want to show a map.
    – Stefan
    Commented Jan 9, 2013 at 8:33
0

I found a solution with Mapserver version 6.0.3.

You need to add a validation in the layer-part. Like this:

VALIDATION # for validation of runtime substitution
        'maand' '^[0-9]{6}$'
        'tabelnaam' '^[a-zA-Z\-_]+$'
END

Then the runtime substitution is working in the data parameter

DATA "geom from (select * from %month%.%tablename%) as selection using unique gid using srid=28922"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.