Changes between Version 10 and Version 11 of GIS/OpenStreetMap


Ignore:
Timestamp:
12/08/14 10:40:36 (10 years ago)
Author:
Fran Boon
Comment:

Update Mirror docs

Legend:

Unmodified
Added
Removed
Modified
  • GIS/OpenStreetMap

    v10 v11  
    460460
    461461== Mirror ==
    462 How to set up a local mirror for Africa with selected Feature types, suitable for use by Import PoI:
    463 {{{
    464 apt-get install -y postgresql-8.4-postgis postgresql-contrib
     462How to set up a local mirror for a country, optionally with just selected Feature types, suitable for use by Import PoI:
     463{{{
     464Debian stable
     465apt-get install sudo
     466visudo
     467fran ALL = NOPASSWD: ALL
     468
     469cat << EOF >> "/etc/apt/sources.list.d/pgdg.list"
     470deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main
     471EOF
     472wget --no-check-certificate https://www.postgresql.org/media/keys/ACCC4CF8.asc
     473apt-key add ACCC4CF8.asc
     474apt-get update
     475
     476apt-get -y install postgresql-9.3 python-psycopg2 postgresql-9.3-postgis ptop postgresql-contrib
     477
     478# Tune PostgreSQL
     479cat << EOF >> "/etc/sysctl.conf"
     480## Increase Shared Memory available for PostgreSQL
     481# 512Mb
     482kernel.shmmax = 279134208
     483# 1024Mb (may need more)
     484#kernel.shmmax = 552992768
     485kernel.shmall = 2097152
     486EOF
     487sysctl -w kernel.shmmax=279134208 # For 512 MB RAM
     488#sysctl -w kernel.shmmax=552992768 # For 1024 MB RAM
     489sysctl -w kernel.shmall=2097152
     490
     491sed -i 's|#track_counts = on|track_counts = on|' /etc/postgresql/9.3/main/postgresql.conf
     492sed -i 's|#autovacuum = on|autovacuum = on|' /etc/postgresql/9.3/main/postgresql.conf
     493# 512Mb RAM:
     494sed -i 's|shared_buffers = 28MB|shared_buffers = 56MB|' /etc/postgresql/9.3/main/postgresql.conf
     495sed -i 's|#effective_cache_size = 128MB|effective_cache_size = 256MB|' /etc/postgresql/9.3/main/postgresql.conf
     496sed -i 's|#work_mem = 1MB|work_mem = 2MB|' /etc/postgresql/9.3/main/postgresql.conf
     497# If 1Gb+ RAM, activate post-install via pg1024 script
     498
     499adduser osm
    465500mkdir -p /home/osm/planet/replication
    466501cd /home/osm
    467502wget http://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-latest.tgz
     503mkdir osmosis
     504cd osmosis
    468505tar zxvf osmosis-latest.tgz
    469 ln -sf /home/osm/osmosis-0.41 /home/osm/osmosis
    470506chown -R postgres /home/osm
    471507su postgres
     
    474510\q
    475511createdb -O osm -E UTF8 osm -T template0
    476 createlang plpgsql -d osm
    477 psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
    478 psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
    479 psql -d osm -f /usr/share/postgresql/8.4/contrib/hstore.sql
     512psql -d osm -f /usr/share/postgresql/9.3/extension/postgis--2.1.4.sql
     513#psql -d osm -f /usr/share/postgresql/9.3/extension/hstore--1.2.sql
     514psql
     515\c osm
     516create extension hstore;
     517\q
    480518psql -d osm -f /home/osm/osmosis/script/pgsnapshot_schema_0.6.sql
    481519psql
     
    495533
    496534cd /home/osm/planet
    497 wget http://download.geofabrik.de/openstreetmap/africa.osm.pbf
    498 /home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/africa.osm.pbf --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --write-pbf /home/osm/planet/eurosha.osm.pbf
    499 su postgres
    500 /home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha.osm.pbf --write-pgsql database=osm user=osm password=planet
     535# Either grab snapshot from GeoFabrik or use HOT Export Tool
     536#wget http://download.geofabrik.de/africa/cameroon-latest.osm.pbf -O extract.osm.pbf
     537wget http://export.hotosm.org/download/023803/rawdata.osm.pbf -O extract.osm.pbf
     538
     539apt-get install -y openjdk-7-jre
     540
     541# If wishing to filter the data to just certain types of object
     542#mv extract.osm.pbf full.osm.pbf
     543#/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/full.osm.pbf --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --write-pbf /home/osm/planet/extract.osm.pbf
     544su postgres
     545/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/extract.osm.pbf --write-pgsql database=osm user=osm password=planet
    501546
    502547cd /home/osm/planet/replication
    503548/home/osm/osmosis/bin/osmosis --rrii
    504549sudo -H -u postgres psql -d osm -c "select max(tstamp) from nodes";
    505 http://toolserver.org/~mazder/replicate-sequences/
    506 Put timestamp into site, select hourly
    507 vim state.txt
     550# http://osm.personalwerk.de/replicate-sequences/
     551# (Code: https://github.com/MaZderMind/replicate-sequences)
     552# Put timestamp into site, select hourly
     553vi state.txt
    508554# paste in contents from website
    509 vim configuration.txt
     555vi configuration.txt
    510556baseUrl=http://planet.openstreetmap.org/replication/hour
    511557
    512 /home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/eurosha.osm.pbf --ac --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --tf reject-relations --write-pbf /home/osm/planet/eurosha-new.osm.pbf
    513 /home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha-new.osm.pbf --read-pbf /home/osm/planet/eurosha.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
    514 mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
    515 vim  /home/osm/replicate.sh
     558# If wishing to filter the data to just certain types of object
     559#/home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/extract.osm.pbf --ac --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --tf reject-relations --write-pbf /home/osm/planet/new.osm.pbf
     560#/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/new.osm.pbf --read-pbf /home/osm/planet/extract.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
     561/home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/extract.osm.pbf --ac --write-pbf /home/osm/planet/new.osm.pbf
     562/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/new.osm.pbf --read-pbf /home/osm/planet/extract.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
     563mv /home/osm/planet/new.osm.pbf /home/osm/planet/extract.osm.pbf
     564vi /home/osm/replicate.sh
    516565#!/bin/sh
    517566n=`ps -ef | grep -v grep | grep /home/osm/osmosis/ | wc -l`
    518567if [ $n -le 0 ]
    519568then
    520         if [ -s /home/osm/planet/eurosha-new.osm.pbf ]
     569        if [ -s /home/osm/planet/new.osm.pbf ]
    521570        then
    522         mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
     571        mv /home/osm/planet/new.osm.pbf /home/osm/planet/extract.osm.pbf
    523572fi
    524 /home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/eurosha.osm.pbf --ac --tf accept-nodes amenity=hospital,place_of_worship,school --tf accept-ways amenity=hospital,place_of_worship,school --tf reject-relations --write-pbf /home/osm/planet/eurosha-new.osm.pbf
    525 /home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/eurosha-new.osm.pbf --read-pbf /home/osm/planet/eurosha.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
    526 mv /home/osm/planet/eurosha-new.osm.pbf /home/osm/planet/eurosha.osm.pbf
     573/home/osm/osmosis/bin/osmosis --rri workingDirectory=/home/osm/planet/replication/ --simc --read-pbf /home/osm/planet/extract.osm.pbf --ac --write-pbf /home/osm/planet/new.osm.pbf
     574/home/osm/osmosis/bin/osmosis --read-pbf /home/osm/planet/new.osm.pbf --read-pbf /home/osm/planet/extract.osm.pbf --dc --write-pgsql-change database=osm user=osm password=planet
     575mv /home/osm/planet/new.osm.pbf /home/osm/planet/extract.osm.pbf
    527576fi
    528577
    529578chmod 0755 /home/osm/replicate.sh
    530 vim /etc/crontab
     579vi /etc/crontab
    5315801 *   * * * root    /home/osm/replicate.sh
    532581}}}
     
    536585sudo -H -u postgres psql -d osm -c "select max(tstamp) from nodes";
    537586}}}
    538 
    539 ---
    540 
    541 [wiki:GIS GIS]