QGIS recently added new WMS server capabilities to its software stack. Breaking into the server world, the new server can read a QGIS project project file and serve maps to the internet. This amazing new feature, really brings QGIS users to a new set of possibilities.

QGIS logo

Today I found some time to test some new amazing QGIS features. One of the most interesting additions is the WMS integrated server.

I usually test all new projects in my user directory, I created a folder ‘~/public_html/qgis-client/’ to host this test.

Next step was to enable CGI handling, since I run apache under Linux and all I had to do was to create a file named ‘.htaccess’ in the ‘~/public_html’ folder:

AddHandler cgi-script .fcgi .cgi
Options +ExecCGI
SetEnv LD_LIBRARY_PATH /home/myuser/app/lib

This few lines, enable CGI and add a search path to the library loader, this was necessary for the handler to load my QGIS trunk build, located in ‘~/app/’.

Now I needed to symlink the qgis-mapserv.fcgi executable into the project folder:

cd ~/public_html/qgis-client/
ln -s ~/app/bin/qgis_mapserv.fcgi .
~/app/bin/wms_metadata.xml .
vim ~/app/bin/wms_metadata.xml

The last command allows the customization of the GetCapabilities response.

I was now able to serve a qgis project with the WMS protocol, the project location can be specified with the map parameter, like this:

http://localhost/~myuser/qgis-client/qgis_mapserv.fcgi?map=/home/ale/public_html/qgis-client/qgis-client.qgs
It's only fair to share...Tweet about this on TwitterShare on FacebookShare on LinkedInPin on PinterestShare on RedditShare on Google+