Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
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 Jan 9 '13 at 8:33
add comment

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"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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