Archive for the ‘mapserver’ Category
Web Mapping Services & Security
For the majority of public GIS systems I’ve worked on all the data in a database is available to users via the mapping interface. If someone wanted to hack in and “steal” data the only concern would be the bandwidth they took up. Security for these systems is fairly low down on the list of priorities, if it’s on the list at all.
GIS systems with organisational data are often only accessible (in theory) through an Intranet, so if the network is well protected then so isthe GIS.
There have only been a few mapping systems I’ve worked on where there is a mix of public data and datasets with restrictive access in the same database. The location of rare bird species (people will go to some lengths for a rare egg) and hallucinogenic mushrooms in a Biodiversity GIS being an example.
I’m currenty designing a MapServer system that will serve out WMS layers to the public, and a few which are limited to certain IP address ranges. WMS and security was something I had never previously investigated. The rest of this post outlines the current situation, and an attempt to restrict WMS access on my server.
Running Python through Apache
I’m trying (and having) to start using Python more and more due to its ubiquity in the OpenSource GIS world. There are a number of add-ons and libraries for MapServer that require Python to function properly and/or quickly. It is also widely used for scripting both MapServer objects and for raster manipulation using GDAL. I initially set up Python under Apache to run the Tilecache tile server.
According to the ModPython site – “Python will run many times faster than traditional CGI and will have access to advanced features such as ability to retain database connections.”
Mod_python is an Apache module that embeds the Python interpreter within the server, and can be downloaded from their site. There are versions for both Unix and Windows, which makes it ideal for MapServer for Windows (MS4W). Ironically after saying that using Python for web applications is many times faster than CGI, the ModPython download page uses CGI..
WMS GetCapabilities
Yes, I’d like to see the map layers and capabilities available from my MapServer MAP file, and no I don’t want to download mapserv.exe..
Messing with Headers
I had the same problem with both Firefox and Internet Explorer 7 each time I issues a request such as:
http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/my.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
The browser tried to download mapserv.exe. The “exe” did actually contain the GetCapabilities XML, but it is very annoying to have to manually open it in another program each time.
This is a FAQ on the MapServer site which suggested that a program needs to be manually associated with the MIME type returned by the requests – application/vnd.ogc.wms_xml.
Map Server Expression Errors
Errors…
After turning on logging to diagnose an issue with MapServer I found a more worrying error, that was causing the log file to fill up at a rate of about 2MB a minute! I was reusing a legend for five or six datasets, and it was causing the following debug notes:
[Thu Jan 07 15:28:21 2010].629000 msyyparse(): Expression parser error. syntax error [Thu Jan 07 15:28:21 2010].629000 msEvalExpression: Expression parser error. Failed to parse expression: ( >= 2.251) AND ( <= 2.5)
Map Server Logging
To turn on logging in MapServer Read the rest of this entry »
MapServer and SQL Server 2008 Plug-in
The SQL Server 2008 plugin for MapServer is a “native driver modeled on the PostGIS driver to
support SQL Server 2008’s newly added spatial capabilities.” It works fine for displaying data as WMS layers in OpenLayers however I ran into all sorts of problems when trying to use the GetFeatureInfo WMS query.
With MapServer 5.2.1 (installed using MapServer for Windows – MS4W v2.3.1) no error message was returned, however neither was any data . I initially thought this was due to the following bug in the plugin, which was reported to have been fixed for MapServer 5.4.
3 MapServer & SQL Server 2008 Performance Tips
A current project I’ve been developing uses a combination of SQL Server 2008 and MapServer (for Windows) to
serve many WMS layers. As much as it irks developers, web users only care about two things – how nice the site looks, and how fast it is. Whether the correct information is displayed comes a poor third..
I’ve found a number of tweaks that have dramatically improved the WMS creation speed. In these examples I’m using a table in SQL Server 2008 with 50773 features (Irish Townlands if you’re asking).
Quantum GIS and MapServer
One of the main barriers I had to using MapServer as a web GIS server was that layers had to be symbolised i
n a text editor, using a MAPFILE. It was cumbersome to keep editing and refreshing a browser, there was no easy way to check for errors, and you have to learn the syntax and keywords.
Whilst this is ok for smaller projects where I could make these myself, larger projects require non-programmers to gather data, symbolise it, and handle the map layouts and creation.
I’ve just discovered that another of the OSGeo‘s projects, Quantum GIS (often abbreviated to QGIS) has a tool that can take a map project created and symbolised in the desktop application, and export it to a MAPFILE which can be read by MapServer. This seems to be the missing link in a complete Open Source GIS stack.