vendredi 11 janvier 2013


Installation de Mapserver
Avec le support ECW, FGDB et PostgreSQL/PostGIS

Contexte

Ce document explique chacune des étapes requises pour la mise en place d’un serveur cartographique (WMS) à partir du code source de Mapserver (ainsi que ses dépendances) pour une distribution Linux RedHat Enterprise 5 (64 bits).

Historique

Création du document 11-01-2013 MartinOuellet

Pré-requis


  • Outils de compilation
    • sudo yum install gcc gcc-c++ autoconf automake

  • Dépendances
    • sudo yum install python python-devel krb5-devel readline-devel make swig pcre-devel libpng libpng-devel bzip2-devel fontconfig fontconfig-devel libxml2-devel openssl-devel curl-devel giflib-devel zlib-devel gettext libjpeg-devel libtiff-devel


  • Permissions

  • sudo chown -R <username> /usr/local/src  (pour compiler le code source à cet endroit)
  • PATH=$PATH:/usr/sbin

Installation

Les version des diverses composantes utilisées dans le présent peuvent variées.  Elles correspondent aux versions les plus récentes en date du 10 janvier 2013

1. libecwj


2. libFileGDBAPI (étape optionelle)


  • Librarie requise pour supporter le format vectoriel propriétaire .FGDB (ESRI)
  • Voir http://trac.osgeo.org/gdal/wiki/FileGDB
  • Se replacer dans le répertoire src
    • cd /usr/local/src
  • Récupérer la librairie téléchargée au préalable du site d’ESRI (vous devez avoir un compte “Global ESRI” et vous connecter au préalable): http://www.esri.com/apps/products/download/
  • Décompresser directement dans /usr/local/
    • sudo tar xvzf FileGDB_API_1_3-64.tar.gz -C /usr/local/
  • Voir aussi le fichier README (une fois le fichier zip décompressé...)
  • Modifier la variable d’environnement pour ajouter le nouveau PATH
    • LD_LIBRARY_PATH=/usr/local/FileGDB_API/lib:$LD_LIBRARY_PATH
  • Ajouter (/usr/local/FileGDB_API/lib) à la fin du fichier /etc/ld.so.conf.  Ne pas préfixer le path avec include
  • Mise à jour les liens vers les libraries
    • sudo /sbin/ldconfig
    • cd /usr/local/FileGDB_API/lib
    • sudo ln -sf libfgdbunixrtl.so libfgdblinuxrtl.so (path car ça plantait...)
    • sudo /sbin/ldconfig
  • Compiler les exemples (pour vérifier l’installation)
    • cd /usr/local/FileGDB_API/samples
    • make
  • Tester l’installation
    • cd /usr/local/FileGDB_API/samples/bin
    • ./Querying

devrait afficher

Bellingham      52179   -122.468,48.7439
Havre   10201   -109.68,48.5438
Anacortes       11451   -122.631,48.4922
Mount Vernon    17647   -122.316,48.4216
Oak Harbor      17176   -122.629,48.3079
Minot   34544   -101.297,48.2337
Kalispell       11917   -114.318,48.1993
Williston       13131   -103.631,48.1623
Port Angeles    17710   -123.456,48.105

Commerce
Pico Rivera
Maywood
Huntington Park
Bell
West Whittier-Los Nietos
Bell Gardens
Whittier
Cudahy
South Gate
Downey
Santa Fe Springs
South Whittier
Lynwood
Norwalk
La Mirada
Paramount
Bellflower
Cerritos
Artesia
Buena Park
La Palma
Lakewood
Hawaiian Gardens
Cypress
Stanton
Los Alamitos
Long Beach
Seal Beach
Westminster
Huntington Beach

3. freetype


4. geos


5. proj4



  • Il faut ajouter la définition des projections manquantes (900913, 32187, etc...) dans le fichier epsg en fonction de vos jeux de données
    • sudo vi /usr/local/share/proj/epsg
    • Exemple INNON-COMPLET
    • # WGS 84 / Pseudo-Mercator
<3857> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs <>

  • # google spherical mercator
<900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs

  • # google spherical mercator
<900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs

  • # NAD83 / MTM zone 7
<32187> +proj=tmerc +lat_0=0 +lon_0=-70.5 +k=0.9999 +x_0=304800 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs  <>

6. gdal


  • Librarie requise pour le support des données géospatiales (vectorielles et matrciielles)
  • Note: si vous avez compilé la librairie pour le format FGDB, la spécifier
    • ./configure --with-ecw=/usr/local --with-python --with-fgdb=/usr/local/FileGDB_API --with-pg=/usr/pgsql-9.2/bin/pg_config
    • make (peut prendre quelques minutes...)
    • sudo make install

7. mapserver




    • tar -zxvf mapserver-6.2.0.tar.gz
    • cd mapserver-6.2.0
    • ./configure --prefix=/usr/local/ --with-gdal=/usr/local/bin/gdal-config --with-ogr=/usr/local/bin/gdal-config --with-curl=/usr/bin/curl-config[[BR]] --enable-debug --with-proj=/usr/local/ --with-tiff=/usr/ --with-jpeg=/usr/local/ --with-freetype=/usr/local/ --with-threads --with-xml2-config=/usr/bin/xml2-config --with-png=/usr/ --with-wmsclient --with-wfsclient --with-wcs --with-wfs --with-postgis --with-postgis=/usr/pgsql-9.2/bin/pg_config --with-geos=/usr/local/bin/geos-config
    • make
    • sudo make install
  • Vérifier l’installation
    • sudo yum install httpd
    • sudo /etc/init.d/httpd start
    • sudo cp -pr mapserv /var/www/cgi-bin/
    • cd /var/www/cgi-bin/
    • sudo ./mapserv -v

devrait afficher

MapServer version 6.2.0 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE


devrait afficher

No query information to decode. QUERY_STRING is set, but empty.