Hello Gurus,
Back in the day (about 6 months ago?) I was able to setup a starting map
server and render this map:
http://twitpic.com/2frt4o

Since then my memory has fogged with other non-related tasks. With a new
computer and Ubuntu 10.10 (Maverick Meerkat) to test on, I was able to get
everything setup. Everything seems* to work, but the contours don't render.
Below is a slightly adjusted (some links/locations have changed over last
few months) step-by-step of everything I did. May I trouble you for critique
on how I can improve my process, and also give a guess as to why I have no
contours?

Best regards,

Chris

=======

#upgrade and update here

#get build environment going
sudo apt-get install -y g++ cpp \
libboost1.40-dev libboost-filesystem1.40-dev \
libboost-iostreams1.40-dev libboost-program-options1.40-dev \
libboost-python1.40-dev libboost-regex1.40-dev \
libboost-thread1.40-dev \
libxml2 libxml2-dev \
libfreetype6 libfreetype6-dev \
libjpeg62 libjpeg62-dev \
libltdl7 libltdl-dev \
libpng12-0 libpng12-dev \
libgeotiff-dev libtiff4 libtiff4-dev libtiffxx0c2 \
libcairo2 libcairo2-dev python-cairo python-cairo-dev \
libcairomm-1.0-1 libcairomm-1.0-dev \
ttf-unifont ttf-dejavu ttf-dejavu-core ttf-dejavu-extra \
subversion build-essential python-nose

# also a bug in cairomm requires manually grabbing libsigc++:
# https://bugs.launchpad.net/ubuntu/+source/cairomm/+bug/452733
sudo apt-get install -y libsigc++-dev libsigc++0c2 libsigx-2.0-2
libsigx-2.0-dev

# install plugin dependencies
sudo apt-get install -y libgdal1-dev python-gdal \
postgresql-8.4 postgresql-server-dev-8.4 postgresql-contrib-8.4
postgresql-8.4-postgis \
libsqlite3-dev

#tmp
cd /tmp

svn co http://svn.mapnik.org/tags/release-0.7.1/ mapnik
cd mapnik
python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3
SYSTEM_FONTS=/usr/share/fonts/
#This next line takes FOREVER. Go for a walk:
python scons/scons.py
sudo python scons/scons.py install

sudo ldconfig

sudo apt-get install unzip
sudo apt-get install aptitude
#choose Y

#inspired by instructions from http://wiki.openstreetmap.org/wiki/Mapnik
#also notes from http://osmpunjab.co.cc/node/9
#and
http://codebrainz.ca/index.php/2009/09/27/installing-mapnik-and-friends-on-ubuntu-904/
mkdir /home/owntheweb/tools
cd /home/owntheweb/tools

#osm2pgsql package is/was outdated, install from source
sudo aptitude install libbz2-dev
#choose Y
sudo apt-get install -y autoconf
svn export http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/
cd osm2pgsql/
./autogen.sh
./configure
sudo make
sudo make install
cd ../

#gather the goods
wget
http://download.cloudmade.com/americas/northern_america/united_states/colorado/colorado.osm.bz2
svn co http://svn.openstreetmap.org/applications/rendering/mapnik
cd mapnik

wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz # (50M)
wget http://tile.openstreetmap.org/processed_p.tar.bz2 # (227M)
wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 # (46M)
wget
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/10m-populated-places.zip#
(1.5 MB)
wget
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m-admin-0-boundary-lines.zip#
(38 KB)
wget
http://trac.openstreetmap.org/browser/applications/utils/export/osm2pgsql/900913.sql?format=raw-O
900913.sql

tar xzf world_boundaries-spherical.tgz # creates a 'world_boundaries' folder
tar xjf processed_p.tar.bz2 -C world_boundaries
tar xjf shoreline_300.tar.bz2 -C world_boundaries
unzip -q 10m-populated-places.zip -d world_boundaries
unzip -q 110m-admin-0-boundary-lines.zip -d world_boundaries

sudo pico /etc/sysctl.conf
### kernel.shmmax=268435456 #add this to end of file
#avoid reboot
sudo sh -c 'echo 268435456 >/proc/sys/kernel/shmmax'

sudo /etc/init.d/postgresql restart

sudo -u postgres -i
createuser -s owntheweb
createdb -E UTF8 -O owntheweb gis
createlang plpgsql gis
exit

psql -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql -d gis
echo "ALTER TABLE geometry_columns OWNER TO owntheweb; ALTER TABLE
spatial_ref_sys OWNER TO owntheweb;" | psql -d gis
psql -f /usr/share/postgresql/8.4/contrib/_int.sql -d gis
psql -d gis -f /home/owntheweb/tools/osm2pgsql/900913.sql

#takes a short while, grab a glass of water and eat a cracker with peanut
butter:
cd ../
bunzip2 -dv colorado.osm.bz2

#cd /usr/bin #if apt-get install osm2pgsql was fresh
#if installing from source:

cd /usr/local/bin

#annoying error occurs as osm2pgsql is looking in wrong folder for
default.style - here is work around:
sudo cp /usr/local/share/osm2pgsql/default.style
/usr/local/share/default.style

time ./osm2pgsql --slim -d gis /home/owntheweb/tools/colorado.osm

#contours
sudo apt-get install gdal-bin
cd /home/owntheweb/tools
mkdir contours
cd contours
wget
http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/N38W104.hgt.zip
wget
http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/N39W104.hgt.zip
wget
http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/N38W105.hgt.zip
wget
http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/N39W105.hgt.zip
#wget http://mpa.itc.it/rs/srtm/srtm_generate_hdr.sh #not found anymore
wget
http://mapnik-utils.googlecode.com/svn/sandbox/testing/hillshading/srtm_generate_hdr.sh

#!/bin/bash
PREP_TABLE="1"
for X in *.hgt.zip; do
    yes | sudo sh srtm_generate_hdr.sh $X
    rm -f "${X%%.zip}"

    # Import 10m contours
    rm -f "${X%%.hgt.zip}.shp" "${X%%.hgt.zip}.shx" "${X%%.hgt.zip}.dbf"
    gdal_contour -i 10 -snodata 32767 -a height "${X%%.hgt.zip}.tif"
"${X%%.hgt.zip}.shp"
    [ "$PREP_TABLE" ] && shp2pgsql -p -I -g way "${X%%.hgt.zip}" contours |
psql -q gis
    shp2pgsql -a -g way "${X%%.hgt.zip}" contours | psql -q gis

    rm -f "${X%%.hgt.zip}.shp" "${X%%.hgt.zip}.shx" "${X%%.hgt.zip}.dbf"
    rm -f "${X%%.hgt.zip}.bil"
    rm -f "${X%%.hgt.zip}.hdr"
    rm -f "${X%%.hgt.zip}.prj"
    rm -f "${X%%.hgt.zip}.tif"
    unset PREP_TABLE
done

cd /home/owntheweb/tools/mapnik
chmod +x generate_xml.py
./generate_xml.py --dbname gis --accept-none

sudo pico generate_image.py
-edit bounding box from London to new mapping area, Colorado Springs: ll =
(-104.932, 39.034, -104.594, 38.67)
./generate_image.py

#oops! contours are not rendered. get new osm.xml that supports contours?
mv osm.xml osmOriginal.xml
#http://trac.openstreetmap.org/browser/applications/rendering/mapnik/osm.xml#had
to do this manually via browser?

./generate_image.py

#no dice - same result without contours :(
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to