3

I'm working with cgi-bin and I show a map with some data from a Postgres database.

But, I need to introduce an input where the user could select a date and this date would filter the results from the database.

I have the input and I send the parameter by the URL (get method), but I don't know how to get this parameter from the cgi-bin query string and how to concatenate the parameter's value to the database query.

This is the mapfile's code portion:

LAYER
DATA "the_geom from (select * from
  vista_puntos where date > <DATE_VAR_FROM_QUERY_STRING>) as subquery
  using unique id_valor using srid=4326"
Ryan Kohn
  • 13,079
  • 14
  • 56
  • 81
Oscar Martínez
  • 65
  • 1
  • 2
  • 9
  • You might want to look into geomoose since it is a framework that has this kind of functionality integrated... Good Luck! – NicoTek Jun 22 '12 at 17:20

1 Answers1

0

use select query in DATA after that use FILTER *MAPSERV* create a Where clause for Filter

example

    DATA "geom from roads"
    FILTER "type='%road1%' or type='%road2%'"

        CLASS
            NAME "Road Type1"
            EXPRESSION ('[type]' = 'type1')
            STYLE
                SIZE 10
                COLOR 255 0 0 
            END
        END

        CLASS
            NAME "Road Type2"
            EXPRESSION ('[type]' = 'type2')
            STYLE
                SIZE 10
                COLOR 0 255 0
            END
        END

Query String format is like : ..mapserv.exe?map=mapfile&road1=type1&road2=type2

Yogesh Prajapati
  • 4,770
  • 2
  • 36
  • 77