OpenStreetMap: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 46: Line 46:
  # dart
  # dart
  createdb -U postgres osm
  createdb -U postgres osm
createuser -U postgres osm
  psql -U postgres osm  
  psql -U postgres osm  
  CREATE EXTENSION hstore;
  CREATE EXTENSION hstore;
  CREATE EXTENSION postgis;
  CREATE EXTENSION postgis;
  osm2pgsql us-west-latest.osm.pbf -d osm -U postgres -S /home/AGI/bwilson/src/GIS/osm2pgsql/default.style --hstore -C 3000
# Just Oregon - I had to increase the node cache size on Dart where I am loading US West not just Oregon. -C 3000
  osm2pgsql us-west-latest.osm.pbf -d osm -U osm -S /home/AGI/bwilson/src/GIS/osm2pgsql/default.style --hstore -C 3000
# The whole planet
osm2pgsql planet-latest.osm -d osm -U osm -S ~/src/GIS/osm2pgsql/default.style --hstore -C 5000


I had to increase the node cache size on Dart where I am loading US West not just Oregon. -C 3000
On my little server [[Bellman]], it took 628 seconds to load the Oregon data and it took 3302 seconds to load California. Conclusion: California is much bigger, in fact there is probably room for me there in Nevada county.


On my little server[ [Bellman]], it took 628 seconds to load the Oregon data
I just loaded Oregon data onto my much snazzier server at work and it took 183 seconds.
and it took 3302 seconds to load California. Conclusion: California is much bigger, in fact there is probably room for me there in Nevada county.
 
I just loaded Oregon data onto my much snazzier server at work and it took
183 seconds.


Nice to have some data in my PostGIS server.
Nice to have some data in my PostGIS server.


Now I need to get it showing up in [[Geoserver]]
Now I need to get it showing up in [[Geoserver]]

Revision as of 21:13, 7 June 2013

Using excellent instructions from http://bostongis.com/ In particular, the Almost idiot's guide...

First, get the data from CloudMade for California and Oregon

mkdir /green/GISData/OSM && cd /green/GISData/OSM
wget http://downloads.cloudmade.com/americas/northern_america/united_states/california/california.osm.bz2
wget http://downloads.cloudmade.com/americas/northern_america/united_states/oregon/oregon.osm.bz2

Create a lovely Postgis database

createdb -U postgres osm -W -T template_postgis

My installed-from-source Postgis did not have hstore.sql so I built it:

cd ~/src/GIS/postgresql-9.0.6/contrib/hstore
USE_PGXS=1 make && sudo USE_PGXS=1 make install
cd /usr/local/pgsql/share/contrib

Do this each time you create a database a: add hstore support to the database

psql -U postgres osm < hstore.sql

Build osm2pgsql

No need for any special configuration options, just build and install!

sudo apt-get install libxml2-dev libbz2-dev
cd ~/src/GIS
git clone https://github.com/openstreetmap/osm2pgsql.git
cd osm2pgsql
./autogen.sh
./configure
sed -i 's/-g -O2/-O2 -march=native -fomit-frame-pointer/' Makefile
make
sudo make install

Using osm2pgsql

# bellman
osm2pgsql oregon.osm.bz2 -d osm -U postgres \
-S /green/bwilson/src/GIS/osm2pgsql/default.style --hstore
osm2pgsql california.osm.bz2 --append -d osm -U postgres \
-S /green/bwilson/src/GIS/osm2pgsql/default.style --hstore
# dart
createdb -U postgres osm
createuser -U postgres osm
psql -U postgres osm 
CREATE EXTENSION hstore;
CREATE EXTENSION postgis;
  1. Just Oregon - I had to increase the node cache size on Dart where I am loading US West not just Oregon. -C 3000
osm2pgsql us-west-latest.osm.pbf -d osm -U osm -S /home/AGI/bwilson/src/GIS/osm2pgsql/default.style --hstore -C 3000
  1. The whole planet
osm2pgsql planet-latest.osm -d osm -U osm -S ~/src/GIS/osm2pgsql/default.style --hstore -C 5000

On my little server Bellman, it took 628 seconds to load the Oregon data and it took 3302 seconds to load California. Conclusion: California is much bigger, in fact there is probably room for me there in Nevada county.

I just loaded Oregon data onto my much snazzier server at work and it took 183 seconds.

Nice to have some data in my PostGIS server.

Now I need to get it showing up in Geoserver