Introduction
MapServer is an open source and free software for rendering maps, images, and vector data on the web. MapServer was originally developed by the University of Minnesota (UMN) ForNet project in cooperation with NASA and the Minnesota Department of Natural Resources. Presently, the MapServer project is hosted by the TerraSIP, a NASA sponsored project between the UMN and consortium of land management interests (http://mapserver.gis.umn.edu).
MapServer can be compiled on many platforms and operating systems, but in this tutorial, I will focus on unix like system, especially Linux.
Prerequisites
Operating system used in this tutorial is Linux Fedora Core 7 with Apache (httpd-2.0.55), PHP (php-5.2.3), and PostgreSQL(postgresql-8.2.4) already installed using manual source installation (not using default rpm package). Required libraries that already installed are libpng, libjpeg, libtiff, and zlib. Installation manual for those softwares and libraries are beyond the scope of this tutorial.
Required softwares and libraries:
Source: http://download.osgeo.org/mapserver/mapserver-5.0.2.tar.gz
Source: http://www.libgd.org/releases/gd-2.0.35.tar.gz
Source: ftp://ftp.remotesensing.org/proj/proj-4.6.0.tar.gz
Source: http://geos.refractions.net/downloads/geos-3.0.0.tar.bz2
Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
Source: http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
Source: http://curl.haxx.se/download/curl-7.18.1.tar.gz
Source: http://www.postgis.org/download/postgis-1.3.3.tar.gz
Note:
Apache was installed under /usr/local/apache
PostgreSQL was installed under /usr/local/pgsql
All previously installed libraries (libpng, libjpeg, libtiff, and zlib) were installed under /usr/lib
Apache root directory is /data/www/html, cgi-bin directory is /data/www/cgi-bin
Installation
GD
Installation steps:
Note: default installation directory is /usr/local
PROJ.4
Installation steps:
Note: default installation directory is /usr/local
GEOS
Installation steps:
Note: default installation directory is /usr/local
GDAL
Installation steps:
Note: default installation directory is /usr/local
CURL
Installation steps:
Note: default installation directory is /usr/local
Update ld-config
PostGIS
Installation steps:
Recompile PHP as CGI
Installation steps:
> –with-gd=/usr/local/ \
> –with-jpeg-dir=/usr/lib \
> –with-png-dir=/usr/lib \
> –with-tiff-dir=/usr/lib \
> –with-zlib-dir=/usr/lib \
> –with-freetype-dir=/usr/lib \
> –without-ttf \
> –with-mysql=/usr/local/mysql/ \
> –with-pgsql=/usr/local/pgsql/ \
> –with-curl=/usr/local/ \
> –with-gettext \
> –enable-ftp \
> –enable-xml \
> –with-zlib \
> –with-regex=system \
> –enable-dbase \
> –enable-dbx \
> –with-config-file-path=/usr/local/lib
Note: DO NOT do a “make install”
MapServer
Installation steps:
> –with-gdal=/usr/local/bin/gdal-config \
> –with-httpd=/usr/local/apache/bin/httpd \
> –with-wfsclient \
> –with-wmsclient \
> –enable-debug \
> –with-curl-config=/usr/local/bin/curl-config
> –with-proj=/usr/local \
> –with-tiff \
> –with-gd=/usr/local \
> –with-jpeg \
> –with-freetype=/usr/ \
> –with-threads \
> –with-wcs \
> –with-postgis=/usr/local/pgsql/bin/pg_config \
> –with-libiconv=/usr \
> –with-geos=/usr/local/bin/geos-config \
> –with-xml2-config=/usr/bin/xml2-config \
> –with-sos \
> –with-php=../php-5.2.3/
Note: DO NOT do a “make install”
PHP MapScript installation steps:
extension_dir = “/usr/local/lib/php/extensions” extension = “php_mapscript.so”
AddType application/x-httpd-php-cgi .phtml Action application/x-httpd-php-cgi /cgi-bin/php-cgi
Test PHP Mapscript
To test PHP MapScript that already installed:
To test drawing map, you can download simple demo application from http://www.londatiga.net/downloads/tutorial/phpmapscript-demo.tar.gz
To test PHP MapScript that already installed:
You can download PDF version of this tutorial here
UPDATES 06 June 2008
For latest version of Linux such as Fedora Core 9, it comes with newest gcc compiler (gcc 4.3) , compiling those packages above may cause some errors (error when run make command on geos-3.0.0, gdal-1.5.1 and mapserver-5.0.2). To overcome this problem, download the latest version of those packages. At the time i write this update, latest version of gdal is gdal-1.5.2RC3 and mapserver is mapserver-5.0.3, for geos, download the following patch: geos-3.0.0-gcc43.patch .
Related post:
Una consulta… me aparece un error al instalar gdal, al momento de hacer el “make” sale el siguiente mensaje.
make[1]:se sale del directorio ‘/usr/local/gdal-1.5.1/apps’
Alguna sugerencia??
Gracias
hola kaztel, ¿podría mostrar varias líneas de sus mensajes de error?
Gracias
Hola Lorenz
Ya solucione mi problema me faltaban unas dependencias del gdal.
Muchas Gracias
Thnx alot,
I’ve been having problems installing on openSUSE10.3
Would this work on OpenSUSE??
thanks again.
@styxGH
I never tested it on openSuse, but if all required libraries are installed, it must be going well
Best Regards
I had a make error like kaztel.
/usr/bin/ld: cannot find -lodbcinst
collect2: ld returned 1 exit status
make: *** [shp2img] Error 1
found the fix here:
https://bugzilla.redhat.com/show_bug.cgi?id=232792#c2
a redhat bugzilla I think about building the mapserver 4.10.1-2 rpm
” This is because `$GDAL_CONFIG –dep-libs` in configure adds
unnecessary linkages.
Applying a patch for configure to remove the above seems
good. For sed usage,
”
——————————————————-
%sed -i.libs -e ’s|`\$GDAL_CONFIG –dep-libs`||’ configure
Lorenz boleh………
dudeng 99′ers
one more link giving steps for mapserver installation
http://sudhendra.blogspot.com/
Factors in the choice of rods | Best and Free tips on the Plastic ……
With brazing or welding, which do not contain filler welding electrodes are necessary for methods of joining metals. For persons working in the welding wire ……
Yeah, I have to admire the landlord’s unique point of view, this article is very comprehensive and considerable on the analyse, and greatly inspired me. In addition, I would like to share that some other blog’s article, content is also very good, if you scan it,there will be a suprise!
cp mapscript/php3/php_mapscript.so /usr/local/lib/php/extensions
I did not get any php_mapscript.so file at mapscript/php3/
How will i get this?
Thanks
Amirul
there is no file shptreest in mapserver but shptreetst
mas, boleh minta tutorial pemasangan apache dan postgreSQL nya mas?
thanks before