The WebApp Wizard Web development made magical

24Jun/107

MapServer 5.7-dev for Windows

MapServer 5.6.3 is fine, but there is still a bug in this release. This bug is currently fixed in the SVN trunk, but is not released yet.

If you send a WFS GetFeature request, with POST parameters, you may not have all the data you expect in return. In fact, you will miss the geometry data (yes, too bad :-( ). I really needed this feature to work as soon as possible, so I decided to try compiling the latest SVN version by myself.

First of all, let me tell you that I'm quite a beginner with MapServer... So maybe my instructions are not the best, but hey, it just works. I also assume that if you read this article, you have the minimum necessary knowledge about Windows C/C++ development and Apache administration.

After trying (in vain) a few times following MapServer instructions for compiling on Win32 (these instructions seem to be a bit outdated), I found the Gateway Geomatics package that included all the sources and libs needed to compile it successfully using Visual Studio 2008. But that still needed some adjustments to work just fine. Here are the steps I had to complete to compile MapServer 5.7-dev successfully.

Compiling MapServer for Windows (using VS 2008)

  • Donwload the mapserver buildkit
  • Download regex-0.12-lib and regex-0.12-bin
  • Copy regex-0.12-lib/ and regex-0.12-bin/ into regex-0.12/
  • Copy regex.h under mapserver-trunk/
  • Copy expat.h et expat_external.h under mapserver-trunk/renderers/agg/src/
  • Copy zlib.h and zconf.h under libpng-1.2.35/
  • In mapserver-trunk/nmake.opt,change path to WS2_32.lib (something like C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\WS2_32.Lib should be OK)
  • In mapserver-trunk/nmake.opt, comment out PHP_REGEX
  • In mapserver-trunk/nmake.opt, deactivate JPEG12
  • In mapserver-trunk/nmake.opt, change REGEX_OBJ to $(REGEX_DIR)\lib\libregex.lib
  • Run C:\Program Files\Microsoft Visual Studio 8\

And then hit nmake /f Makefile.vc :-) . That should do the trick. All the files mentionned above should be found either in the mapserver buildkit, or in the regex-0.12-lib / regex-0.12-bin packages. I let you use the windows search or your brain to find these files.

Installing as Apache 2.2 CGI

Nothing special here. Just copy mapserver.exe and depending DLLs.

If you use it on the same computer as the one used to compile, that should work right away. If, like me, you plan to use it on a server on which Visual Studio is not even installed, you might need the following:

  • Copy your x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989.cat and x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989.manifest in %WINDIR%/WinSxs/Manifests/
  • Copy your x86_policy.8.0.Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_x-ww_77c24773/ directory in %WINDIR%/WinSxS/Policies/
  • Copy your x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989/ directory in %WINDIR%/WinSxS/

Again, you should be able to find these files and directories quite easily, under your %WINDIR%/WinSxS folder.

All these steps work for me (compiled on a Win7 32 bit and also used on a Win2003 Server 32 bit). You might need some adjustments following your architecture (especially if you work on a 64 bit OS).

Comments (7) Trackbacks (0)
  1. hi, do you use command line to run vc2008? or gui?

  2. Hi tiplip, I used the command line (nmake /f Makefile.vc). But I guess using the GUI would work fine too.

  3. thanks Pierre,

    Yes, I have done that with GUI, just a little adjustment needed.
    Another question, have you done some webgis based on mapserver? I am planning that.

  4. Yes, that’s why I struggled so much with this. But that was not very convincing, due to a lack of time to work on that, I had other priorities at work. But someday, I’ll be back on this too do something really useable. You can find some examples and tutorials on OpenLayers.

    You also have Google Maps, which has a really nice, well-documented and quite easy to understand API. The problem I was facing at this time was performance issues when using massive and complex polygon overlays. But now it seems that this is not a problem anymore.
    But if you have to use MapServer, want to be independent, or maybe simply have a “real” GIS, you should probably look on the MapServer / OpenLayers side.

    Hope that helps.

  5. Thanks.
    I have an in-house webserver using C++, based on Poco, which I want to use to call mapserver directly instead of CGI, mapscript and the like, maybe it’s a daunting work because I have not found any recommendations on such way.
    Hope I can go through with it:)

  6. Well, that goes a little beyond my very basic knowledge about GIS, so all I can do is… Wish you good luck! :-)

  7. huh, I have done that, my webserver calling C api of MapServer directly:), can work fine with example downloaded from mapserver official site.
    Now facing a new problem, routing between start point and end point with raster input is a big struggle for me:)


Leave a comment

(required)

You can use basic HTML to enlighten your comments. If you want to post some code, please use the <pre> tag. You can also use syntax coloring by adding class="syntax [language]". <pre class="syntax js"> will color your code as if it was JS code for instance.

No trackbacks yet.