[mapserver-users] The right tool for the job

Milo van der Linden mlinden at zeelandnet.nl
Wed Feb 20 15:03:44 EST 2008


Colin Wetherbee schreef:
>
> I would like my first step to be putting a static image on a web site. 
> The image would be generated by Perl and returned to the browser as a 
> simple image/png.
>
> The method I have in mind follows.
>
> Each user has a set of airports and routes with which they are 
> concerned.  This set of airports and routes could change as frequently 
> as every 30 seconds.  So, for each map generation request, I would 
> dynamically create a map file and store it as TEXT in my PostgreSQL 
> database, along with some unique ID.  Then, I would output an <img /> 
> tag to the browser that includes the unique ID of this 
> dynamically-generated map file:
Interesting approach. But you could also try:
http://www.someserver.org/cgi-bin/mapserv.exe?map=ergens.map&REQUEST=getmap&Layers=layer1,layer2,layer3&User=MyUser&Airport=1,5,23,56&airline=KLM&......

The mapfile is able to read user variables; this means

that the value MyUser that is in the variable User can be addressed in 
the mapfile with %User%

Thus making it possible to have a layer that builds it's content from a 
postGIS query dynamically like:

SELECT(THE GEOM) FROM Airports where ActiveUser=%User

This way you don't need to store mapfiles in the database and let the 
form-variables in your webpage feed the dynamic content of the map.

Read the topic on 
http://mapserver.gis.umn.edu/docs/reference/mapfile/variable_sub

The time stamp can also be set on a layer through a variable like this.



>
> <img src="/foo/mapImage.pl?id=1234" />
>
> mapImage.pl sees id=1234, pulls map file 1234 out of the database, 
> uses the MapServer back-end to generate a map, then outputs this map 
> as an image/png.  I think mapImage.pl ends up being pretty simple: 
> create a mapserver object, pipe the map file text to it, and get the 
> png it generates.  Is that it, or am I thinking too narrowly here?
>
> I may include a time stamp, too, so I can expire map files after some 
> length of inactivity.
>
> Does this sound about right?
>
> Thanks for your help. :)
>
> Colin
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>



More information about the mapserver-users mailing list