[OSM-talk] [Fwd: Re: Newbie - queries and usability suggestions]
John McKerrell
john at mckerrell.net
Fri Nov 24 17:32:24 GMT 2006
Hi Jonas
I've been meaning to tidy this up, but here's my "installing on
ubuntu" howto. I'm using latest Ubuntu and am generating tiles fine.
There was a few problems with accessing the database when I finished
as I've never used postgres before, but hopefully this'll get you a
bit further along:
Ubuntu OSM Tile rendering steps
Download planet from one of the links here:
http://wiki.openstreetmap.org/index.php/Planet.osm
Place it somewhere on your system, be aware the unzipped file is >5Gb.
sudo apt-get update
sudo apt-get dist-upgrade
mkdir osm
cd osm
sudo apt-get install build-essential
sudo apt-get install subversion
svn co svn://svn.berlios.de/mapnik/trunk mapnik
cd mapnik
sudo apt-get install build-essential libfreetype6-dev libltdl3-dev \
libpng12-dev libtiff4-dev libboost-thread-dev libboost-filesystem-dev \
libboost-serialization-dev libboost-regex-dev libboost-python-dev \
libboost-program-options-dev proj
sudo apt-get install postgresql-8.1
sudo ln -s /usr/lib/libboost_python.so /usr/lib/libboost_python-gcc-
mt.so
python scons/scons.py install
cd demo/c++
g++ -O3 -I/usr/local/include/mapnik -I/usr/include/boost -I/usr/
include/freetype2 -L/usr/local/lib -lmapnik rundemo.cpp -o rundemo
sudo vi /etc/ld.so.conf
Add /usr/local/lib
sudo ldconfig
./rundemo /usr/local/lib/mapnik/input
Creates demo.jpg and demo.png, open and check they're ok.
In the following block of code, replace 'john' with your username on
the system. This will be your username for the database.
sudo su
su postgres
createdb -Upostgres -EUNICODE osm2006
createuser -Upostgres -S -D -R john
psql -Upostgres osm2006
GRANT ALL ON SCHEMA PUBLIC TO john;
Return to your user account, should be:
exit
exit
Go to here to install PostGIS
http://postgis.refractions.net/support/wiki/index.php?PostgisOnUbuntu
Or follow these instructions:
sudo apt-get install postgresql-server-dev-8.1 libgeos-dev proj
postgresql-client-8.1 postgresql-contrib-8.1 postgresql-doc-8.1
postgresql-plperl-8.1 postgresql-plpython-8.1 postgresql-server-dev-8.1
cd ..
mkdir postgis
# Update following line to latest version from http://
postgis.refractions.net/download/
wget 'http://postgis.refractions.net/download/postgis-1.1.6.tar.gz'
tar xvfz postgis-1.1.6.tar.gz
cd postgis-1.1.6
sudo apt-get install flex
sudo apt-get install bison
./configure --prefix=/usr --with-pgsql=/usr/bin/pg_config --with-
geos=/usr/bin/geos-config --with-proj=/usr
make
sudo make install
cd ../../mapnik
sudo python scons/scons.py PGSQL_INCLUDES=/usr/include/postgresql
PGSQL_LIBS=/usr/lib/postgresql/8.1/lib install
sudo su postgres
psql -Upostgres osm2006
create language plpgsql;
psql -Upostgres osm2006 < /usr/share/lwpostgis.sq
psql -Upostgres osm2006
GRANT ALL on geometry_columns TO osm;
GRANT ALL on spatial_ref_sys TO osm;
CREATE TABLE planet_osm (
osm_type char(1),
osm_id bigint,
name text,
place text,
landuse text,
leisure text,
waterway text,
highway text,
amenity text,
tourism text,
learning text
);
SELECT AddGeometryColumn('planet_osm', 'way', 4326, 'GEOMETRY', 2);
ALTER TABLE planet_osm ADD CONSTRAINT pk__planet_osm PRIMARY KEY
(osm_type, osm_id);
CREATE INDEX planet_spatial_idx ON planet_osm USING gist (way
GIST_GEOMETRY_OPS);
Exit postgres, exit shell to go back to your default user.
cd ..
svn checkout http://svn.openstreetmap.org
YOU REALLY SHOULDN'T HAVE TO DO THE FOLLOWING, BUT I'M TRYING TO
DOCUMENT EVERYTHING I DID
cd mapnik
svn update
sudo python scons/scons.py install
cd ..
END OF STUFF YOU SHOULDN'T HAVE TO DO
I had disk space issues because the location that I placed my
planet.osm.bz2 did not have enough space to hold the unzipped
planet.osm. You might want to unzip the file, then run something like
the following command:
svn.openstreetmap.org/utils/planet.osm/C/UTF8sanitizer <
planet-061120.osm > planet-sanitised.osm
but the command I ran was:
bzcat planets/planet-061120.osm.bz2 | svn.openstreetmap.org/utils/
planet.osm/C/UTF8sanitizer > /media/disk1/planets/planet-sanitised.osm
What this does is unzip the file on the fly, pass the output to the
UTF8sanitizer and send the output to a location that I have more disk
space.
sudo apt-get install libxml2-dev
cd svn.openstreetmap.org/utils/osm2pgsql/
make
cd ../../..
svn.openstreetmap.org/utils/osm2pgsql/osm2pgsql /media/disk1/planets/
planet-sanitised.osm > /media/disk1/planets/planet.sql
sudo su postgres
time psql -U postgres osm2006 < /media/disk1/planets/planet.sql > /
tmp/insert.log
Took about 35 minutes on my Athlon 2300 and ended up with 3657839 rows.
Log back out of postgres and go back to your osm directory
mkdir tiling
cd tiling
wget 'http://trac.openstreetmap.org/browser/utils/mapnik/
generate_tiles.py?format=raw' -O generate_tiles.py
wget 'http://trac.openstreetmap.org/browser/utils/mapnik/osm.xml?
format=raw' -O osm.xml
svn checkout http://svn.openstreetmap.org/utils/mapnik/symbol
wget -r -l 1 http://artem.dev.openstreetmap.org/vmap0
mv artem.dev.openstreetmap.org/vmap0/
rm -rf artem.dev.openstreetmap.org
rm vmap0/index.html*
Edit generate_tiles.py editing the values at the end of the file to
match your system.
Edit osm.xml
Use search and replace to replace all instances of /home/steve/vmap0
with the correct path on your system, /home/john/osm/tiling/vmap0 for
me.
Use search and replace to replace all instances of /home/steve/
symbols with the correct path on your system, /home/john/osm/tiling/
symbols for me.
Use search and replace a number of times to replace host, user and
dbname in the DataSource tags. Mine ended up looking like this, if
you've followed my instructions yours will look similar, with the
user 'john' replaced with your own username:
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="host">localhost</Parameter>
<Parameter name="port">5433</Parameter>
<Parameter name="user">john</Parameter>
<Parameter name="dbname">osm2006</Parameter>
<Parameter name="table">planet_osm</Parameter>
</Datasource>
Essentially that should be it and you will be able to generate tiles,
there'll probably be issues though which you can bring back to the
mailing list :-)
John
On 24 Nov 2006, at 17:03, Jonas Svensson wrote:
>
>
> On 24 Nov 2006 at 1:36, Joerg Ostertag (OSM Munich/Ge wrote:
>
>>
>> PS.: A short installation micro-howto is attached.
>>
>
> I am trying to follow that to do some mapnick rendering and got a
> problem:
> Package postgresql-8.1-plruby does not seem to exist in ubuntu, is
> it really needed?
>
> /Jonas
>
>
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
More information about the talk
mailing list