|
|
(33 intermediate revisions by the same user not shown) |
The content of the new revision is missing or corrupted. |
Line 1: |
Line 1: |
| == How I built MapServer for CDS ==
| |
|
| |
|
| The [http://mapserver.gis.umn.edu/ mapserver home] is now a lovely wiki site full of useful information. A good way to start is to go to the Documentation page and look for the pages linked there on compilation.
| |
|
| |
| === Overview ===
| |
|
| |
| Install the packages in the prerequisites section first, and then
| |
| build things in the order presented here, as there are interdependencies.
| |
|
| |
| # php gets built from source
| |
| # proj and gdal-bin install from Ubuntu packages
| |
| # mapserver is built from source
| |
|
| |
| === Package prerequisites ===
| |
|
| |
| Originally I built PHP/Mapscript to run under Apache 2.0.54 on a system based on
| |
| [http://www.trustix.org/ Trustix Linux] 2.2. (This happens to be the system most readily available at the moment.) I have TSL 2.2 or 3.0 on all my servers.
| |
|
| |
| I am now migrating to Ubuntu, so I will be doing a build there momentarily.
| |
|
| |
| For performance reasons I want to use PHP as a loadable module so I am
| |
| building PHP/Mapscript.
| |
|
| |
| Software development packages on TSL you will need include
| |
|
| |
| flex
| |
| gcc
| |
| gcc-c++-devel
| |
| glibc-devel
| |
| make
| |
|
| |
| Relevant packages that need to be installed with TSL 2.2 include, from a to z,
| |
| (same holds true for TSl 3.0)
| |
|
| |
| apache apache-devel
| |
| freetype freetype-devel
| |
| gd gd-devel
| |
| libjpeg libjpeg-devel
| |
| libpng libpng-devel
| |
| libtiff libtiff-devel
| |
| xorg-x11-libs xorg-x11-devel
| |
| expat expat-devel
| |
| zlib zlib-devel
| |
|
| |
| There are probably a few that I missed. If you use the swup tool with TSL, it will resolve and automatically install other packages that depend on these.
| |
|
| |
| To build PHP and MapServer, you need the '*-devel' packages. Running only requires the base packages.
| |
|
| |
| The xorg packages have many other things in them, but they are needed to build the XPM bitmap support which is mostly unneeded, I suppose.
| |
|
| |
| Packages on Ubuntu include
| |
|
| |
| build-essential (which installs many compiler tools and libraries)
| |
| flex
| |
| make (which should already be installed)
| |
| apache2-threaded-dev
| |
| libxpm-dev libjpeg-dev libpng-dev
| |
| libfreetype6-dev
| |
| libgd2-xpm-dev
| |
|
| |
| There is actually a mapserver package for Ubuntu, but it lags behind and I want all the latest features!
| |
|
| |
| I install emacs on all my systems and when I do that on Ubuntu it pulls in a lot of the packages that are needed to build the mapserver stuff.
| |
|
| |
| === PHP ===
| |
|
| |
| Since support for PHP5 is still considered experimental, I am still holding out and using 4.4.x source for PHP.
| |
|
| |
| I get the source for PHP 4.4.2 from http://www.php.net/
| |
|
| |
| The options I used for the PHP 4.4 configure script on Ubuntu are:
| |
|
| |
| ./configure \
| |
| --with-apxs2=`which apxs2` \
| |
| --with-pear \
| |
| --with-gd=/usr --enable-gd-imgstrttf \
| |
| --with-freetype-dir=/usr \
| |
| --with-jpeg-dir=/usr \
| |
| --with-png-dir=/usr \
| |
| --with-xpm-dir=/usr/X11R6 \ ''this is probably not needed''
| |
| --enable-gd-native-ttf \
| |
| --with-zlib \
| |
| --with-gettext \
| |
| --with-xml \
| |
| --with-mysql \
| |
| --with-pgsql
| |
|
| |
| [[Note on configure files]]
| |
|
| |
| Then the usual
| |
|
| |
| make
| |
| su
| |
| make install
| |
|
| |
| The 'make install' step will modify your httpd.conf file to include the module
| |
| but you have to restart apache completely ('apachectl restart' will not work.)
| |
|
| |
| apachectl stop
| |
| apachectl restart
| |
|
| |
| If you create a file containing <code><?php phpinfo(); ?></code>
| |
| and put it in your Web server somewhere, you can test your PHP installation and see what is enabled and see many many other details. Here is my example: http://neptune.cds1.net/phpinfo.php
| |
|
| |
| === MapServer supporting cast of characters ===
| |
|
| |
| ==== Projections ====
| |
|
| |
| Projection transforms are handled by [http://proj.maptools.org/ PROJ]
| |
| which is currently at revision 4.4.9
| |
|
| |
| Proj includes a library for performing respective forward and inverse transformation of cartographic data to or from cartesian data with a wide range of selectable projection functions.
| |
|
| |
| Once you've plowed through the PHP build, it's almost not worth trying to find a pre-built package. You do need the g++ compiler which is in the '''gcc-c++-devel''' package. Then it's just a matter of downloading and unpacking the proj tar file and doing the traditional
| |
|
| |
| ./configure
| |
| make
| |
| su
| |
| make install
| |
|
| |
| ==== Raster and vector file support ====
| |
|
| |
| GDAL is for raster files, OGR is for vector files.
| |
|
| |
| '''GDAL''' is the "Geospatial Data Abstraction Library".
| |
| GDAL is a translator library for [http://www.gdal.org/formats_list.html raster geospatial data formats].
| |
|
| |
| Again, there might be a gdal pre-built package for TSL but what the heck, it is easy to build from sources, you get the latest version that way, and you don't waste time messing around with figuring out which Redhat version works on TSL.
| |
|
| |
| As of today version 1.3.0 is available from http://www.gdal.org/dl/<br>
| |
|
| |
| The [http://ogr.maptools.org/ OGR] library is a subcomponent of GDAL so you don't need to worry about it if you install GDAL. The OGR Simple Features Library allows MapServer users to display several types of vector data files in their native formats. For example, MapInfo Mid/Mif and TAB data do not need to be converted to ESRI shapefiles when using OGR support with MapServer.
| |
|
| |
| I built the entire GDAL package with './configure; make; su; make install'
| |
|
| |
| It takes a long time to build GDAL and OGR unless you have a modern, fast computer. It's a big collection of tools.
| |
|
| |
| === Building MapServer ===
| |
|
| |
| As of this writing, I am building with source version 4.8.3.
| |
| The configuration I used for the actual MapServer build looks like this:
| |
|
| |
| ./configure \
| |
| --with-httpd=/usr/sbin/httpd \
| |
| --with-gd \
| |
| --with-freetype \
| |
| --with-jpeg \
| |
| --with-png \
| |
| --with-tiff \
| |
| --with-proj \
| |
| --with-ogr=/usr/local/bin/gdal-config \
| |
| --with-gdal=/usr/local/bin/gdal-config \
| |
| --with-wfs \
| |
| --with-php=../php-4.4.2 \
| |
| --with-wmsclient ''for chameleon''
| |
|
| |
| This builds both the CGI executable 'mapserv' and the PHP/Mapscript module.
| |
| There are options to build for other languages including java, perl, python, ruby, and tcl. I might try the python variant soon since I am already using it on the Windows side. If so, I will update this document.
| |
|
| |
| There is no 'make install' option for MapServer. You have to manually copy the files to the correct places. For my system the commands are
| |
|
| |
| cp mapserv /home/httpd/cgi-bin/
| |
| mkdir /usr/local/lib/php/extensions
| |
| cp mapscript/php3/php_mapscript.so /usr/local/lib/php/extensions
| |
|
| |
| The first line will install the CGI executable, which is not really the exciting part. But you can test it immediately without any input; here is my copy: http://neptune.cds1.net/cgi-bin/mapserv
| |
| If it works, you will get a page containing this line:
| |
|
| |
| No query information to decode. QUERY_STRING is set, but empty
| |
|
| |
| ==== Activating PHP/Mapscript ====
| |
|
| |
| If you just installed php you probably don't have any extensions, so you have add a directory in which to store them. Then you have to put the mapscript module there.
| |
|
| |
| The module will not be loaded unless you add a line in php.ini (mine is in /usr/local/lib) thusly:
| |
|
| |
| extension=php_mapscript.so
| |
|
| |
| You have to restart Apache to get the module to load. You can't really type in a URL to test it but you can still see information about it with [http://neptune.cds1.net/phpinfo.php phpinfo] as mentioned above.
| |
|
| |
|
| |
| There are several map services such as WMS and WCS that I choose not to build yet as I am not using them.
| |
|
| |
| If you have the right proprietary libraries you can build versions of MapServer that support MrSID and ArcSDE.
| |
|
| |
| == Running Mapserver on Linux ==
| |
|
| |
| Well, I am going to jump back over to the main [[MapServer]] doc here; aside from the obvious differences with paths in the MAP file, it should not really matter whether you are running Apache/PHP on Linux or IIS/PHP on Windows.
| |