Ubuntu 14.04安装地里编码软件Nominatim过程

.必须软件:

Ubuntu系统编译运行Nominatim软件系统必须安装的软件有:

1.GCC 编译器

2.postgresql 数据库

3.proj4

4.geos

5.postgis

6.PHP

7.PHP-pgsql

8.PEAR::DB

9.protobuf

10.wget

11.osmis

.安装必须的软件包

Apt-get install build-essential libxml2-dev libgeos-dev libpq-devlibbz2-dev

apt-get install gcc proj-bin libgeos-c1 osmis

apt-get install php5 php-pear php5-pgsql php5-json php-db

apt-get install postgresql postgis postgresql-contribpostgresql-9.3-postgis

由于导入的地理数据格式为pbf,所以需要安装pbf支持软件

apt-get install libprotobuf-c0-dev protobuf-c-compiler

debian系统中,geos运行需要另一个包

apt-get install libgeos++-dev

postgresql配置:

打开/etc/postgresql/9.3/main中的postgresql.conf文件,设置如下属性:

fsync = off

full_page_writes = off

具体命令为:

sudo vim /etc/postgresql/9.3/main中的postgresql.conf

.安装Nominatim

1.下载源码

wget http://www.nominatim.org/release/Nominatim-2.2.0.tar.bz2

tar xvf Nominatim-2.2.0.tar.bz2

cd Nominatim-2.2.0

./sutogen.sh

./configure

make

2.Nominatim目录中的settings目录里新建local.php文件,

配置如下:

<?php

// Paths

@define('CONST_Postgresql_Version', '9.3');

@define('CONST_Postgis_Version', '2.1');

@define('CONST_Website_BaseURL', 'http://localhost/nominatim/');



3.新建postgres用户账户:

1.新建导入账户

adduser <自己的用户名,example:mypg>

passwd <密码>

su – postgres

psql -template1

界面切换到数据库的交互界面,敲入如下命令:

CREATE USER <自己的用户名,example:mypg>WITH PASSWORD <密码>

退出数据库交互界面,敲入命令:\q

切换到root

新建网站用户:

createuser -SDR www-data

更改nominatim的读取权限:

chmod +x /soft_src

chmod +x /soft_src/Nominatim-2.2.0

chmod +x /soft_src/Nominatim-2.2.0/module

倒入下载的OSM数据,并为其建立索引:

下载数据地址为(pbf格式):

http://download.geofabrik.de/openstreetmap/

导入pbf数据:

./Nominatim-2.2.0/utils/setup.php --osm-file<自己下载的pbf数据,shanghai.osm.pbf>--all [--osm2pgsql-cache ]

添加额外字段:

./Nominatim-2.2.0/utils/specialphrases.php –countries >specialphrases_countries.sql

psql -d nominatim -f specialphrases_countries.sql

./Nominatim-2.2.0/utils/specialphrases.php –wiki-import >specialphrases.sql

psql -d nominatim -f specialphrases.sql

建立网站:

sudo mkdir -m 755 /var/www/nominatim

sudo chown <your username> /var/www/nominatim

./utils/setup.php --create-website /var/www/nominatim

配置apache环境:

打开/etc/apache2/sites-enabled/000-default,在最后添加如下内容:

<Directory "/var/www/nominatim/">

Options FollowSymLinks MultiViews

AddType text/html .php

</Directory>

重启apache服务:

service apache2 restart

增加mypg对数据库nominatim的权限:

su – postgres

psql template1

GRANT ALL PRIVILEGES ON DATABASE nominatim to mypg

\q



4.运行nominatim

浏览器登陆:http://http://localhost/nominatim/

www-data用户有没有数据库读写权限,若没有,则打开/etc/apache2/envvars,修改

export APACHE_RUN_USER=mypg

export APACHE_RUN_GROUP=mypg

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值