Mapserver

From Wildsong
Revision as of 00:19, 10 September 2005 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

General MapServer notes

MapServer web site

MapServer is for building Web-based GIS applications.

What can I do with MapServer? It can act as a WMS. It can act as a WFS.

What is a WMS? An OGC-compliant "Web Map Server"

What is a WFS? An OGC-compliant "Web Feature Server" allows WFS clients to access feature sets from the WFS instead of entire maps.

You can combine it with other components to enhance its functionality.

Windows / Corvallis implementation

At Public Works, we live in a Windows world here, but why let that slow us down? We started off with ELLAmaps which is based on a MapServer 3. server. Now moving on to something better.

Server software

Three possibilities are FWTools, HoBu, and MS4W

FWTools 0.9.9 - Frank Warmerdam's version built on Python.
Mapserver works but I can't figure out how to enable the python mapscript; it whines about python2.3.dll being unavailable; it's there in the bin/ directory and I don't know how to install it.

HoBu supports Python, PostGIS, ArcSDE, Oracle
Python has to be installed separately. HoBu seems to have what I need and it uses the latest mapserver version (4.6.1).

Very latest versions can be found here: http://hobu.stat.iastate.edu/mapserver/build_output/

I downloaded the MSI file from python.org for Python 2.4.1 and installed it, and added the installation directory to my system environment PATH. (C:/Python) So far so good. My hello.py script (based on p. 189-190 in Kropla's 'Beginning Mapserver) worked on the very first try, ta RA!

MS4W includes Apache and PHP/MapScript; but no Python support, sorry. If you want Apache, the installer actually works. For some reason the Apache binary I downloaded from Apache.org did not.

See also http://www.thesitewizard.com/archive/addcgitoapache.shtml

Okay... I now have Python Mapscript working with Apache and Windows. The problem is, under IIS it cannot find the _mapscript DLL. When run from the command line (in cygwin) it loads the DLL just fine, so the problem is that the DLL is not found when invoked from IIS. Apache is great but I need it to work under IIS.

Success! IIS + Python 2.4 + HoBU

Adam Ryan passed along the secret to get Python Mapscript to work with IIS. The HoBu installer puts the DLL's in the wrong place. It puts them in C:\Python24. Following Adam's suggestion, I keep it all bundled together by moving all the DLL's and the mapscript.py* files to to Lib\site_packages\mapscript\ and then I created an empty __init__.py file there. In scripts, instead of "import mapscript" now I have to use "import mapscript.mapscript as mapscript".

Other software

PIL = Python Imaging Library<br Adam suggested I look at PIL. Have not done so yet.

FWTools

Installation

Download the binary and execute it.

MrSID note Installing support for MrSID plugin requires a version of LizardTech SDK which is not currently available. Oh well.

Configuration

After it's installed you have to enable the CGI portion. I did this by creating a new "Virtual Directory" called fwms, so I can access the mapserv.exe with a URL like this: http://localhost/fwms/mapserv.exe

It gives me the old familiar "No query information to decode. QUERY_STRING not set." error so I know it's executable.

Testing

Now I need to root around and find a MAP file to test it. I built a hello world and a parks map and accompanying template files.

Then I need to build an appropriate URL to test it. How about http://localhost/locn/park.html

or the MS4W Apache version, http://localhost/mapserver/Locn/park.html

Python Mapscript

As mentioned above I set up the hello.py script from Beginning Mapserver. I ran the script from the command line. To make it run as a CGI in IIS, I had to open up the Computer Management IIS interface, bring up the Properties page for my Web server, click on the Home Directory tab, go into the "Configuration..." menu, and add a mapping for the extension ".py".


Here I have a mapscript demo. http://localhost/Locn/park.py

What can I do with FWtools?

OpenEV -- this is the desktop app. FWTools also includes a bundle of command line utilitties; however, in this doc I only care about the extensions to MapServer.

Basically FWtools adds the parts for handling various vector and raster formats.

  • OGR - vector file handling
  • GDAL - raster file handling
  • PROJ4 - handling for projections
  • libtiff, libgeotiff add TIFF raster image support (including LZW)

So therefore I should be able to use TIFF imagery as a background for my park map. Lets try adding the ortho layer... http://localhost/Locn/park_ortho.py