当前位置: 首页 > 工具软件 > UMN MapServer > 使用案例 >

[原创]Ubuntu安装MapServer

丁志勇
2023-12-01

MapServer

MapServer is an Open Source platform for publishing spatial data and interactive mapping applications to the web. Originally developed in the mid-1990’s at the University of Minnesota, MapServer is released under an MIT-style license, and runs on all major platforms (Windows, Linux, Mac OS X).

The MapServer Project Steering Committee (PSC), sanctioned by OSGeo, manages and administers the project which is maintained, improved, and supported by developers from around the world. MapServer is not a full-featured GIS system, nor does it aspire to be.

 

使用MapServer来做Map和WMS的发布是一个很好的选择,而且官网上一直有更新,文档也很全,维护、学习和讨论的人也很多~~~

MapServer在Windows 上安装很方便,下载OSGeo4W就行了,然后根据提示来安装自己interests的地学tools(比如gdal,grass等)就行了~

 

今天说说如何在linux下安装和配置MapServer,我使用的version是ubuntu karmic(9.10)版本

1. Set Ubuntu sources(设定好源)

 

2. Install MapServer(安装MapServer)

// install all reference packages
#sudo apt - get install cgi - mapserver mapserver - bin mapserver - doc php5 - mapscript python - mapscript

// test if MapServer has been installed
#sudo  / usr / lib / cgi - bin / mapserv  - v
MapServer version 
5.4 . 2  OUTPUT = GIF ... ...

 

This is where packages have been installed:(相关包默认安装的位置)

  • mapserv is installed from cgi-mapserver package in /usr/lib/cgi-bin
  • command line utilities (like shp2img) are installed by the mapserver-bin package in /usr/bin
  • some documentations is installed by the mapserver-cod package in /usr/share/doc/mapserver-doc

然后测试一下MapServer cgi是否安装好,可以在firefox地址栏中输入http://localhost/cgi-bin/mapserv? 然后会得到下面一句话:

No query information to decode. QUERY_STRING is set, but empty. (这样就说明已经安装成功了~)

 

3. Download MapServer Demo (下载MapServer的示例文件)

http://mapserver.org/index.html(官网上Download MapServer 5.4.x Demo)

http://biometry.gis.umn.edu/tutorial/sections.html(这个也是MapServer的一个范例教程)

下载后解压到你喜欢的目录

 

4. Configure Apache httpd (配置Apache http web server)

// configure the default file
sudo gedit  / etc / apache2 / sites - available / default
// like follow
<VirtualHost *:8080>
    ServerAdmin mapserverdemo

    DocumentRoot /home/node33/mapserver/ms4w
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /home/node33/mapserver/ms4w>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

我使用的是8080端口(我的80端口不知道安什么软件给占了,修改/etc/apache2/ports.conf文件即可),也许和你的不一样哦(Apache默认为80端口)

NameVirtualHost  * : 8080
Listen 
8080

 

保存和重新启动Apache:

sudo  / etc / init.d / apache2 restart

在firefox中输入http://localhost:port/即可得到你在上面配置的Demo目录


5. Configure the MapServerDemo (配置MapServer的Demo文件)

接下来,你就可以根据MapServer官网上的教程来跑它的Demo了

 

所有配置完成,打完收功!


参考网站:

http://mapserver.org/

http://www.paolocorti.net/2008/01/10/installing-mapserver-in-ubuntu/ 

http://www.cnblogs.com/conanboa

 

 

转载于:https://www.cnblogs.com/conanboa/archive/2010/02/02/1661736.html

 类似资料: