@@ -64,8 +64,6 @@ To make use of the database generated by this tool you will
6464probably also want to install:
6565- Mapnik from http://mapnik.org/
6666
67-
68-
6967Building
7068========
7169Make sure you have installed the development packages for the
@@ -87,6 +85,11 @@ You must create a PostgreSQL user and a database with the
8785PostGIS functions enabled. This requires access as the
8886database administrator, normally the 'postgres' user.
8987
88+ PostGIS version 2.0 or greater is suggested for databases in
89+ production. 1.5.x will work but 2.0 contains enhancements that
90+ should increase speed and reliability as well as add new features
91+ that style sheet authors can use.
92+
9093The default name for this database is 'gis' but this may
9194be changed by using the osm2pgsql --database option.
9295
@@ -105,11 +108,14 @@ $ sudo -u postgres createuser <username>
105108$ sudo -u postgres createdb -E UTF8 -O <username> <dbname>
106109$ sudo -u postgres createlang plpgsql <dbname>
107110
108- Adding the PostGIS extensions. Note the location of the
111+ Adding the PostGIS extensions.
112+ $ sudo -u postgres psql -d <dbname> -c "CREATE EXTENSION postgis;"
113+
114+ On older versions of PostGIS you will have to run .sql scripts. Note the location of the
109115files may vary.
110116
111- $ sudo -u postgres psql <dbname> < /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
112- $ sudo -u postgres psql <dbname> < /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
117+ $ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
118+ $ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
113119
114120Next we need to give the <username> access to update the postgis
115121meta-data tables
@@ -125,30 +131,29 @@ $ sudo psql -u postgres psql -d <dbname> -f 900913.sql
125131If you want to use hstore support then you will also need to enable the PostgreSQL
126132hstore-new extension.
127133
128- $ sudo -u postgres psql <dbname> < /usr/share/postgresql/8.4/contrib/ hstore.sql
134+ $ sudo -u postgres psql -d <dbname> -c "CREATE EXTENSION hstore;"
129135
130- On PostgreSQL 9.1 and above, you can install it by running "CREATE EXTENSION hstore;"
131- in your database.
136+ On PostgreSQL versions before 9.1 you need to install the hstore-new extension instead
137+
138+ $ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/hstore-new.sql
132139
133140Now you can run osm2pgsql to import the OSM data.
134141This will perform the following actions:
135142
136- 1) Osm2pgsql connects to database and creates the following 4 tables
143+ 1) osm2pgsql connects to database and creates the following 4 tables
137144when used with the default output back-end (pgsql):
138145 - planet_osm_point
139146 - planet_osm_line
140147 - planet_osm_roads
141148 - planet_osm_polygon
142- The prefix "planet_osm" can be changed with the --prefix option,
143- the above is the default.
149+ The default prefix "planet_osm" can be changed with the --prefix option.
144150
145151If you are using --slim mode, it will create the following additional 3 tables:
146152 - planet_osm_nodes
147153 - planet_osm_ways
148154 - planet_osm_rels
149155
150-
151- 2) Runs an XML parser on the input file (typically planet.osm)
156+ 2) Runs a parser on the input file (typically planet-latest.osm.pbf)
152157 and processes the nodes, ways and relations.
153158
1541593) If a node has a tag declared in the style file then it is
@@ -176,7 +181,7 @@ Tuning PostgreSQL
176181
177182For an efficient operation of PostgreSQL you will need to tune the config
178183parameters of PostgreSQL from its default values. These are set in the
179- config file at /etc/postgresql/8.4 /main/postgresql.conf
184+ config file at /etc/postgresql/9.1 /main/postgresql.conf
180185
181186The values you need to set will depend on the hardware you have available,
182187but you will likely need to increase the values for the following parameters:
@@ -262,7 +267,6 @@ subset of all possible tags are stored in the DB. Only ones rendered in
262267the osm.xml are actually interesting to mapnik.
263268- way = PostGIS geometry describing the physical layout of the object.
264269
265-
266270Querying specific data requires knowlege of SQL and the OSM key/value
267271system, e.g.
268272
@@ -296,6 +300,5 @@ osm_id | highway | name
296300 4019199 | trunk |
297301 4238966 | unclassified |
298302
299-
300303See the Postgis docs for details, e.g.
301- http://postgis.refractions. net/docs/ch04 .html
304+ http://postgis.net/docs/manual-2.0/reference .html
0 commit comments