[mapserver-users] Advice for MapServer project

Richard Greenwood richard.greenwood at gmail.com
Wed Feb 27 08:51:54 EST 2008


On Wed, Feb 27, 2008 at 12:44 AM, Timothy Mashford <tmashford at gmail.com> wrote:

>  Can someone just help me understand how the postgresql database could
>  be queried for data within a specific date range? I am thinking that
>  the user could specify the dates in an initialisation page, and these
>  dates could then be stored at hidden CGI variables (or javascript
>  variables?). But if the data sources are specified in the mapfile, how
>  do I pass the dates to postgresql?


There are a couple mechanisms. CGI MapServer has a mode=itemnquery
which accepts a query string. Here's an example:

http://www2.tetonwyo.org/mapserver/mapserv?
  mode=itemnquery
 &qitem=pidn
 &qstring=22-41-16-32-4-41-011
 &qlayer=ownership_spatial
 &mapext=shapes
 &savequery=true

This mode will highlight objects meeting the query criteria, and will
'zoom' the map to minimum bounding rectangle of the select objects.

Another way that I use is to pass the query into the map file with
parameter substitution, for example, in the map file a layer defined
something like:

Layer
   . . .
   CONNECTIONTYPE postgis
   CONNECTION "user=abc password=xyz dbname=pgDB host=localhost"
   FILTER "%datefilter%"
   DATA "the_geom FROM ownership_view USING SRID=2241 USING UNIQUE gid"
   . . .
END

And your query string would look something like:
   datefilter=(date BETWEEN 9/1/1955 AND 9/1/1965)
That probably needs quoted/escaped, but the point is that the map file
FILTER keyword can apply a query and that the %parameter% syntax
transfer a parameter from a URL query string into a map file.

dBox is a good, stable tool which I have used for years. But that's
not to suggest that it is better than OpenLayers, GeoMoose,
MapBuilder, etc.

Note also that via OGR MapServer can read MapInfo .TAB vector files.

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com


More information about the mapserver-users mailing list