MapServerインストール手順

MapServerは、世界で最も使用されているマルチプラットホームのオープンソースWebGISです。
オリジナルは、1990年代中頃に米国ミネソタ大学とミネソタ天然資源局およびNASAとの共同プロジェクトであるForNetプロジェクト(森林資源管理)で開発され、現在はNASAがスポンサーであるTerraSIPプロジェクトから資金を得てミネソタ大学を中心に世界中の開発者(約20人)で開発が続けられおります。
MapServerはCGIベースのシステムであり、商用パッケージに比べて高機能なシステムではありませんが、通常の地図Webアプリケーションを開発するのに十分な機能をサポートしています。
例えば、ミネソタ天然資源局のHPや、カナダ政府の地図サイト(The Atlas of Canada)では、MapServerを使ってリクレーション、天然資源(森林、鉱物)、環境、社会、経済、歴史等の多彩な地図情報を公開しており、高トラフィックのアクセスに対しても高い信頼性が認められております。
その他、欧米を中心として世界の自治体、政府機関や民間での数多くの利用実績があります。

MapServerの公式HP http://MapServer.gis.umn.edu/

ミネソタ天然資源局のHP http://www.dnr.state.mn.us/maps/index.html

カナダ政府の地図サイト  http://atlas.gc.ca/site/english/index.html


Apache, PostgreSQLはインストールされているものとします  *httpd-2.0.50, postgresql-7.4.6で確認

各ソースのダウンロードURL
freetype       http://freetype.sourceforge.net/index2.html

gd          http://www.boutell.com/gd/

gdal         http://www.remotesensing.org/gdal/

geos         http://geos.refractions.net/

httpd         http://httpd.apache.org/

mapserver-patch http://www.foss4g.org/FOSS4G/MAPSERVER/mapserver-int.html

mapserver http://mapserver.gis.umn.edu/

php4      http://www.php.net/

postgis   http://postgis.refractions.net/

postgresql http://www.postgresql.org/

proj     http://proj.maptools.org/

xbase    http://www.e-bachmann.dk/docs/xbase.htm

jpeg lib http://www.ijg.org/files/

TIFF lib ftp://ftp.remotesensing.org

tiff, jpegライブラリのインストール

wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xvzf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --enable-shared
make
make install

wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.7.0.tar.gz
tar zxvf tiff-3.7.0.tar.gz
cd tiff-3.7.0
./configure
make
make install


ラスタライズエンジン freetype2のインストール

tar xvzf freetype-2.1.10.tar.tar
cd freetype-2.1.10
./configure
make
make install


画像処理エンジン gdのインストール

tar xvzf gd-2.0.33.tar.tar
cd gd-2.0.33
./configure --prefix=/usr --without-x
make
make install


phpのインストール

tar -jxvf php-4.3.11.tar.bz2
cd php-4.3.11
./configure
--with-png-dir=/usr/local
--prefix=/usr
--enable-force-cgi-redirect
--with-exec-dir=/usr/bin
--with-layout=GNU
--enable-shared=MAX
--enable-mbregex
--enable-mbstring
--enable-zend-multibyte
--with-freetype=/usr/include/freetype2
--enable-mbstr-enc-trans
--with-regex=system
--with-jpeg=/usr/local
--with-zlib-dir=/usr/local
make, make install
*--with-regex=system は必須
--with-apsx2などHTTPD系のオプションがあるとMapServerをインストールできないのでつけない
すでにPHPをインストールしている場合は、ソース展開後、改めてこのオプションでインストールする

cp php.ini-dist php.ini
cp php.ini /usr/local/lib
cp /usr/bin/php /usr/local/apache2/cgi-bin

#httpd.conf 編集
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php /cgi-bin/php


投影ライブラリ proj.4のインストール

tar xvzf proj-4.4.9.tar.gz
cd proj-4.4.9
./configure
make
make install


ジオメトリ計算エンジン geosのインストール

tar -jxvf geos-2.1.4.tar.bz2
cd geos-2.1.4
./configure
make
make install


地理空間データフォーマット変換ライブラリ gdalのインストール

tar -jxvf geos-2.1.4.tar.bz2
tar xvzf gdal-1.2.0.tar.tar
cd gdal-1.2.0
./configure
make, make install


PostgreSQLで座標をデータを扱えるようにするためのモジュール postgisのインストール

PostgreSQLソース展開フォルダのcontribでアーカイブを展開してインストール
tar xvzf postgis-1.0.5.tar.gz
cp -R postgis-1.0.5 /usr/local/src/postgresql-7.4.6/contrib/
cd /usr/local/src/postgresql-7.4.6/contrib/postgis-1.0.5/
./configure
make
make install


MapServerのインストール

tar xvzf mapserver-4.2.5.tar.gz
cd mapserver-4.2.5
patch -p1 < ../mapserver-4.0.1-encoding.diff
./configure
--with-gd=/usr/local
--with-png=/usr/local
--with-postgis=/usr/local/pgsql/bin/pg_config (PostgreSQLインストールディレクトリ指定)
--with-php=/usr/local/src/php-4.3.11 (PHPソースディレクトリ指定)
--with-proj=/usr/local
--with-gif=/usr/local
--with-freetype=/usr/include/freetype2
--with-zlib=/usr/local
--with-tiff=/usr/local INPUT=TIFF
--with-jpeg=/usr/local INPUT=PNG

*--with-gd , --with-proj, --with-gif, --with-tiff, --with-jpegは/usr/local を指定すること


システムライブラリパスの追加

vi /etc/ld.so.conf
/usr/local/lib
/usr/local/pgsql/lib (PG_HOME/libを追加)
ldconfig


サンプル動作確認

DoccumentRoot:/usr/local/apache/htdocs

wget http://maps.dnr.state.mn.us/mapserver_demos/workshop.zip
unzip workshop.zip
cp -R workshop /user/local/apache2/htdocs/

cd /usr/local/apache2/htdocs/workshop/
vi index.html

<!-- EDIT THE FORM ACTION -->
<form name="demo" method="GET" action="/cgi-bin/mapserv" onSubmit="submit_form()">
<input type="hidden" name="layer" value="lakespy2">
<input type="hidden" name="layer" value="dlgstln2">
<input type="hidden" name="zoomsize" value=2>

<!-- EDIT THESE HIDDEN VARIABLES -->
<input type="hidden" name="map" value="/usr/local/apache2/htdocs/workshop/itasca.map">
<input type="hidden" name="program" value="/cgi-bin/mapserv">
<input type="hidden" name="root" value="/workshop">
<input type="hidden" name="map_web_imagepath" value="/usr/local/apache2/htdocs/tmp/">
<input type="hidden" name="map_web_imageurl" value="/tmp/">

cd /usr/local/apache2/htdocs/
makedir tmp
chmod 777 tmp


workshop/index.htmlにアクセスしてセレクトメニュー選択後、サンプルが確認できればOK

Comment Form

コメントを表示する前に、管理人の承認が必要になることがあります。その場合は、承認されるまでコメントは表示されませんので、ご了承ください。

スタイル用のHTMLタグが使えます

Trackback

Recent entry

Search

Tag Cloud

Page Top