[mapserver-users] Adding a proxy/wrapper between the web frontend (openlayers) and mapserver

Brent Fraser bfraser at geoanalytic.com
Mon Jun 29 07:32:46 PDT 2009


Adrain,

There's some examples of doing similar things at http://mapserver.org/ogc/wms_server.html, specifically the Section named "More About the Online Resource URL"

Best Regards,
Brent Fraser

Adrian Popa wrote:
> Hi everyone! I managed to create such a proxy/wrapper - after I 
> generated the mapfile, I just modified some environment variables and 
> called mapserv as a regular script. Thankfully the evrironment in which 
> my wrapper was called is preserved and sent to mapserv.
> 
> Here's an example:
> 
> #create the mapfile as desired and save the contents to a file who's 
> complete path is stored in $file
> 
> #change the query string and add the map parameter:
> $ENV{'QUERY_STRING'} = $ENV{'QUERY_STRING'}."&map=$file";
> #call the original mapserv script and return the output to the user
> print `/var/www/cgi-bin/mapserv`;
> 
> #all done
> 
> The only major problem I encountered was that mapserver couldn't open 
> the files referenced in the mapfile (fonts, template, shapefiles). I had 
> to specify the  full paths in the map file to get it working.
> 
> Cheers,
> Adrian
> 
> Adrian Popa wrote:
>> Hello everyone!
>>
>> For special reasons (dynamic data) I need to create some sort of 
>> proxy/wrapper around mapserv (5.2) to permit the dynamic modification 
>> of the mapfile based on the age of the specific mapfile.
>> Basically the user will request a mapfile which on most ocasions will 
>> be generated on the fly (server-side). I would like to feed this 
>> mapfile to mapserv and return the image to the user in a way it's 
>> compatible with open layers. The user would see this wapper in a 
>> transparent way.
>>
>> I know how to configure the openlayers part and I know how to generate 
>> the map file, but I'm not sure how to link my wrapper to mapserver...
>> How do I call mapserver the same way the web server would call it? I 
>> think if I call it through a shell, it wouldn't work the same way. I 
>> don't really want to call shp2img because it's harder to maintain.
>>
>> The output part should be straightforward - I would just print out 
>> what mapserver returns - because it should take care of setting 
>> content-type and sending the image.
>>
>> Any tips on where I could start?
>> Thanks!
>>
>> P.S. I'm writing the wapper in perl and I'm not using the mapserver 
>> API (but I could if it's necessary)
>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
> 
> _______________________________________________
> 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