geoserver rendering openstreetmap, v2, part1
Geoserver rendering Openstreetmap update1 (windows)
Two years ago, I started using Geoserver and PostGIS. I was very exciting and satisfied about performance. Since 2009, I don’t have a lot of work about Geoserver. Time flies, last week I have some assignment about Geoserver again. So I can refresh my geoserver memory.
For today, what I am going to do :
1.import latest Openstreetmap data into PostGIS
2.Render it by Geoserver 2.0.1
Here is information about local settings.
–Platform: windows XP SP3
–Postgresql 8.3 + PostGIS 1.3.5
–uDig 1.1.1
–Tomcat 6.0 + Geoserver 2.0.1
To import osm data into PostGIS:
I suggest that you read following articles before you start.
–general information about osm2pgsql tool
http://wiki.openstreetmap.org/wiki/Osm2pgsql
– There is some important information about osm2pgsql tool and PostGIS
http://wiki.openstreetmap.org/wiki/Mapnik
– general information about OpenStreetmap dataset
http://wiki.openstreetmap.org/wiki/Planet.osm
Data and tools:
osm2pgsql windows version
– http://tile.openstreetmap.org/osm2pgsql.zip
osm dataset(I used planet-nl-100423.osm.gz , around 500MB)
http://hypercube.telascience.org/planet/
(sometimes, their service is not available.)
before start:
I have already created one postgis database.
Step1: unzip osm2pgsql to c:\ osm2pgsql\ and add the osm2pgsql path to system path.
http://www.guanxiaoyu.net/wp-content/uploads/2010/05/01.png
add c:\osm2pgsql\osm2pgsql to system path
windows Key + E, show file explorer.
Then on file tree, right click mouse, then click properties.
On properties windows, click ‘Advance ‘Tab
click Environment variable
http://www.guanxiaoyu.net/wp-content/uploads/2010/05/02.png
Edit path :
http://www.guanxiaoyu.net/wp-content/uploads/2010/05/03.png
click ok and ok…
Step2: In the osm2pgsql folder, there is a sql query which named 900913.sql.
Run it on your database, you can run it via pgadmin or psql tool.
Step 3, import data into database.
Open one command window,
type “osm2pgsql -h”
http://www.guanxiaoyu.net/wp-content/uploads/2010/05/04.png
then type “osm2pgsql -c -d YOURDATABASENAME -U postgres -s -v -S c
:\osm2pgsql\osm2pgsql\default.style D:\openstreetmap\planet-nl-
100423.osm.gz”
(When you import data, better switch off all other programs, because importing would take a lot of your ram.)
After a while you should see something like this:
osm2pgsql SVN version 0.69-20874M