Setting up Windows to Handle On-The-Fly Projections with MapServer / MapScript

Note: Installer packages such as MS4W contain Proj ready-to-use.

by Chip Hankley and Frank Warmerdam

MapServer supports on-the-fly projections using the PROJ4 library. See:

Using Prebuilt Binaries

  1. Grab and unpack it, if possible under the root in C:\. This creates a C:\PROJ directory.
  2. If you had to unpack it somewhere else, you will need to set the PROJ_LIB environment variable to point to the NAD directory within it. eg. SET PROJ_LIB=D:\Software\PROJ_446\NAD
  3. Either add the C:\PROJ\BIN directory to your path, or copy C:\PROJ\BIN\PROJ.DLL to somewhere appropriate, like wherever your MAPSERV.EXE is.

You should be good to go, with access to the "epsg" init file, and the various standard NAD27/NAD83 grid shift files.

Building From Source

Set up PROJ4 on a Windows box by doing the following:

  1. Download the latest PROJ4 source from
  2. Un-compress the source documents to the C: drive. The default parent folder will end up being something like C:\PROJ-4.X.X, where the 4-X.X refers to the version. You should rename the parent folder to PROJ.
  3. If you want to support NAD27 to NAD83 datum shifts, also download the US and Canadian datum shift grids from the same site (this should come packaged as a single archive - Zip or Tar). Un-compress this file to the C:\PROJ\NAD directory.
  4. Compile PROJ4.

Using Microsoft Visual C++, you would do the following:

C:\proj\src>"C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
C:\proj\src>nmake /f nadshift

Note that the first line simply sets the environment variable for doing command-line compiling using Microsoft Visual C++. The second line compiles the program AND specifies that you want PROJ4 to be configured to support NAD shifting.

Last modified 8 years ago Last modified on Jan 29, 2009 11:53:21 AM