[osm2pgsql] 01/13: Imported Upstream version 0.86.0

Bas Couwenberg sebastic at xs4all.nl
Sat Oct 25 11:21:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch master
in repository osm2pgsql.

commit 35be4b49246f20e8c35dd8ec4f3f4f632067f76e
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Oct 25 12:41:02 2014 +0200

    Imported Upstream version 0.86.0
---
 .gitignore                             |   3 +
 Makefile.am                            |  12 +-
 README                                 | 305 +--------------------------------
 README.md                              | 136 +++++++++++++++
 binarysearcharray.c                    |   1 -
 binarysearcharray.h                    |   4 +-
 build_geometry.cpp                     |  55 +++++-
 build_geometry.h                       |   1 +
 configure.ac                           |   5 +-
 docs/analysis.md                       |  81 +++++++++
 docs/export.md                         |  12 ++
 docs/gazetteer.md                      |   7 +
 README_lua.md => docs/lua.md           |   0
 docs/osm2pgsql.1                       |  56 +++---
 docs/pgsql.md                          |  54 ++++++
 docs/usage.md                          | 146 ++++++++++++++++
 install-postgis-osm-db.sh              |   9 +-
 m4/ax_lib_geos.m4                      |   2 +-
 m4/ax_lib_protobuf_c.m4                |   4 +-
 middle-pgsql.c                         |   2 +-
 node-persistent-cache.h                |   5 +
 node-ram-cache.c                       |   2 +-
 output-gazetteer.c                     |  90 +++++++---
 output-pgsql.c                         |  10 +-
 parse-o5m.h                            |   2 +-
 parse-pbf.c                            |  37 +---
 parse-pbf.h                            |   2 +-
 parse-xml2.c                           |  16 +-
 parse-xml2.h                           |   2 +-
 pgsql.h                                |   5 +
 style.lua                              |   4 +-
 tagtransform.c                         |   2 +-
 tests/liechtenstein-2013-08-03.osm.bz2 | Bin 0 -> 1061981 bytes
 tests/regression-test.py               |  63 ++++---
 tests/regression-test.sh               | 192 ---------------------
 wildcmp.h                              |   5 +
 36 files changed, 706 insertions(+), 626 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7b6e670..ac18df5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,10 @@ aclocal.m4
 autom4te.cache/
 config.guess
 config.h.in
+config.h.in~
 config.sub
 configure
+compile
 depcomp
 fileformat.pb-c.c
 fileformat.pb-c.h
@@ -18,6 +20,7 @@ m4/ltsugar.m4
 m4/ltversion.m4
 m4/lt~obsolete.m4
 missing
+nodecachefilereader
 osmformat.pb-c.c
 osmformat.pb-c.h
 osm2pgsql
diff --git a/Makefile.am b/Makefile.am
index 051f12d..8959351 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,12 +32,16 @@ BUILT_SOURCES = \
   fileformat.pb-c.c fileformat.pb-c.h \
   osmformat.pb-c.c osmformat.pb-c.h
 
+CLEANFILES = \
+  fileformat.pb-c.c fileformat.pb-c.h \
+  osmformat.pb-c.c osmformat.pb-c.h
+
 endif
 
 osm2pgsqldir = $(datadir)/osm2pgsql
 
-AM_CFLAGS = @PTHREAD_CFLAGS@ @LFS_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@  @PROTOBUF_C_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -DVERSION='"@PACKAGE_VERSION@"' @LUA_INCLUDE@ 
-AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@  @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -Igeos-fallback @LUA_INCLUDE@
+AM_CFLAGS = @PTHREAD_CFLAGS@ @LFS_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@ @GEOS_CFLAGS@ @PROJ_CFLAGS@ @PROTOBUF_C_CFLAGS@ @ZLIB_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -DVERSION='"@PACKAGE_VERSION@"' @LUA_INCLUDE@
+AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@ @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -Igeos-fallback @LUA_INCLUDE@
 
 AM_LDFLAGS = @PTHREAD_CFLAGS@ @ZLIB_LDFLAGS@ @ZLIB_LIBS@ @POSTGRESQL_LDFLAGS@ @POSTGRESQL_LIBS@ @XML2_LDFLAGS@ @BZIP2_LDFLAGS@ @BZIP2_LIBS@ @GEOS_LDFLAGS@ @GEOS_LIBS@ @PROJ_LDFLAGS@ @PROJ_LIBS@ @PROTOBUF_C_LDFLAGS@ @PROTOBUF_C_LIBS@ -L/usr/lib/x86_64-linux-gnu @LUA_LIB@
 
@@ -61,3 +65,7 @@ rpm: dist-gzip
 distclean-local:
 	@rm -f $(PACKAGE).spec
 	@rm -f config.nice
+
+test:
+	tests/regression-test.py -f tests/liechtenstein-2013-08-03.osm.pbf
+	tests/regression-test.py -f tests/liechtenstein-2013-08-03.osm.bz2
diff --git a/README b/README
deleted file mode 100644
index b8b2f85..0000000
--- a/README
+++ /dev/null
@@ -1,304 +0,0 @@
-osm2pgsql
-=========
-Converts OSM planet.osm data to a PostgreSQL / PostGIS database suitable 
-for specific applications like rendering into map tiles by Mapnik
-or geocoding with Nominatim.
-
-osm2pgsql currently supports two different database schemas
-1) A database schema that is optimized for ease of rendering
-by Mapnik.
-2) A database schema that is optimized for geocoding with Nominatim,
-emphasizing the spatially hierarchical organizations of objects.
-
-Both schemas were specifically optimized for the purpose they were
-intended for and they may therefore be less suitable for other
-general purpose processing. Nevertheless, the rendering schema
-might be useful for other purposes as well, and has been used
-for a variety of additionally purposes.
-
-
-For a broader view of the whole map rendering tool chain see
-http://wiki.openstreetmap.org/index.php/Mapnik 
-http://wiki.openstreetmap.org/index.php/Osm2pgsql
-http://wiki.openstreetmap.org/index.php/Slippy_Map
-
-You may find that the wiki pages are more up to date than this
-readme and may include answers to issues not mentioned here.
-
-Any questions should be directed at the osm dev list
-http://wiki.openstreetmap.org/index.php/Mailing_lists 
-
-Features
-========
-- Converts OSM files to a PostgreSQL DB
-- Conversion of tags to columns is configurable in the style file
-- Able to read .gz, .bz2, .pbf and .o5m files directly
-- Can apply diffs to keep the database up to data
-- Support the choice of output projection
-- Configurable table names
-- Gazetteer back-end for Nominatim
-  http://wiki.openstreetmap.org/wiki/Nominatim
-- Support for hstore field type to store the complete set of tags in one database
-  field if desired
-
-Source code
-===========
-The latest source code is available in the OSM git repository on github
-and can be downloaded as follows:
-
-$ git clone git://github.com/openstreetmap/osm2pgsql.git
-
-Build requirements
-==================
-The code is written in C and C++ and relies on the libraries
-below:
-- libxml2    http://xmlsoft.org/
-- geos       http://geos.refractions.net/
-- proj       http://www.remotesensing.org/proj/
-- bzip2      http://www.bzip.org/
-- zlib       http://www.zlib.net/
-- PostgreSQL http://www.postgresql.org/
-- PostGIS    http://postgis.refractions.net/
-
-To make use of the database generated by this tool you will
-probably also want to install:
-- Mapnik from http://mapnik.org/
-
-Building
-========
-Make sure you have installed the development packages for the 
-libraries mentioned in the requirements section and a C and C++
-compiler.
-
-e.g. on Fedora:
-# yum install geos-devel proj-devel postgresql-devel libxml2-devel bzip2-devel gcc-c++
-
-on Debian:
-# aptitude install libxml2-dev libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev protobuf-c-compiler libprotobuf-c0-dev autoconf automake libtool make g++
-
-On most Unix-like systems the program can be compiled by
-running './autogen.sh && ./configure && make'.
-
-Operation
-=========
-You must create a PostgreSQL user and a database with the 
-PostGIS functions enabled. This requires access as the
-database administrator, normally the 'postgres' user.
-
-PostGIS version 2.0 or greater is suggested for databases in
-production. 1.5.x will work but 2.0 contains enhancements that
-should increase speed and reliability as well as add new features
-that style sheet authors can use.
-
-The default name for this database is 'gis' but this may
-be changed by using the osm2pgsql --database option.
-
-If the <username> matches the unix user id running the import
-and rendering then this allows the PostgreSQL 'ident sameuser'
-authentication to be used which avoids the need to enter a
-password when accessing the database. This is setup by default
-on many Unix installs but does not work on Windows (due to the
-lack of unix sockets).
-
-Some example commands are given below but you may find
-this wiki page has more up to data information:
-http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS
-
-$ sudo -u postgres createuser <username>
-$ sudo -u postgres createdb -E UTF8 -O <username> <dbname>
-$ sudo -u postgres createlang plpgsql <dbname>
-
-Adding the PostGIS extensions.
-$ sudo -u postgres psql -d <dbname> -c "CREATE EXTENSION postgis;"
-
-On older versions of PostGIS you will have to run .sql scripts. Note the location of the
-files may vary.
-
-$ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
-$ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
-
-Next we need to give the <username> access to update the postgis
-meta-data tables
-
-$ sudo -u postgres psql -d <dbname> -c "ALTER TABLE geometry_columns OWNER TO <username>"
-$ sudo -u postgres psql -d <dbname> -c "ALTER TABLE spatial_ref_sys  OWNER TO <username>"
-
-The 900913 is not normally included with PostGIS. To add it you
-should run:
-
-$ sudo psql -u postgres psql -d <dbname> -f 900913.sql
-
-If you want to use hstore support then you will also need to enable the PostgreSQL
-hstore-new extension.
-
-$ sudo -u postgres psql -d <dbname> -c "CREATE EXTENSION hstore;"
-
-On PostgreSQL versions before 9.1 you need to install the hstore-new extension instead
-
-$ sudo -u postgres psql -d <dbname> -f /usr/share/postgresql/8.4/contrib/hstore-new.sql
-
-Now you can run osm2pgsql to import the OSM data.
-This will perform the following actions:
-
-1) osm2pgsql connects to database and creates the following 4 tables
-when used with the default output back-end (pgsql):
-   - planet_osm_point
-   - planet_osm_line
-   - planet_osm_roads
-   - planet_osm_polygon
-The default prefix "planet_osm" can be changed with the --prefix option.
-
-If you are using --slim mode, it will create the following additional 3 tables:
-   - planet_osm_nodes
-   - planet_osm_ways
-   - planet_osm_rels
-
-2) Runs a parser on the input file (typically planet-latest.osm.pbf)
- and processes the nodes, ways and relations.
-
-3) If a node has a tag declared in the style file then it is 
- added to planet_osm_point. If it has no such tag then
- the position is noted, but not added to the database.
-
-4) Ways are read in converted into WKT geometries by using the 
- positions of the nodes read in earlier. If the tags on the way 
- are listed in the style file then the way will be written into
- the line or roads tables.
-
-5) If the way has one or more tags marked as 'polygon' and 
- forms a closed ring then it will be added to the planet_osm_polygon
- table.
-
-6) The relations are parsed. Osm2pgsql has special handling for a
- limited number of types: multipolygon, route, boundary
- The code will build the appropriate geometries by referencing the
- members and outputting these into the database.
-
-7) Indexes are added to speed up the queries by Mapnik.
-
-Tuning PostgreSQL
-=================
-
-For an efficient operation of PostgreSQL you will need to tune the config
-parameters of PostgreSQL from its default values. These are set in the
-config file at /etc/postgresql/9.1/main/postgresql.conf
-
-The values you need to set will depend on the hardware you have available,
-but you will likely need to increase the values for the following parameters:
-
-- shared_buffers
-- checkpoint_segments
-- work_mem
-- maintenance_work_mem
-- effective_cache_size
-
-
-A quick note on projections
-===========================
-
-Depending on the command-line switches you can select which projection you
-want the database in. You have three choices:
-
-4326: The standard lat/long coordinates
-900913: The spherical Mercator projection, used by TileCache, Google Earth etc.
-3395: The legacy (broken) WGS84 Mercator projection
-
-Depending on what you're using one or the other is appropriate. The default
-Mapnik style (osm.xml) assumes that the data is stored in 900913 and this 
-is the default for osm2pgsql.
-
-Combining the -v and -h switches will tell about the exact definitions of
-the projections.
-
-In case you want to use some completely different projection there is the -E
-option. It will initialize the projection as +init=epsg:<num>. This allows
-you to use any projection recognized by proj4, which is useful if you want
-to make a map in a different projection. These projections are usually
-defined in /usr/share/proj/epsg.
-
-Database Access Examples
-========================
-If you wish to access the data from the database then the
-queries below should give you some hints. Note that these 
-examples all use the 'latlong' projection which is not the
-default.
-
-$ psql gis
-gis=> \d
-               List of relations
- Schema |        Name        | Type  |  Owner
---------+--------------------+-------+----------
-...
- public | planet_osm_line    | table | jburgess
- public | planet_osm_point   | table | jburgess
- public | planet_osm_polygon | table | jburgess
- public | planet_osm_roads   | table | jburgess
-...
-
-gis=> \d planet_osm_line
-  Table "public.planet_osm_line"
-  Column   |   Type   | Modifiers
------------+----------+-----------
- osm_id    | integer  |
- name      | text     |
- place     | text     |
- landuse   | text     |
-... [ lots of stuff deleted ] ...
- way       | geometry | not null
- z_order   | integer  | default 0
-
-
-Each of the tables contains a subset of the planet.osm file representing
-a particular geometry type
-- Point contains nodes which have interesting tags
-  e.g. place=city, name=London
-  
-- Line contains ways with interesting tags
-  e.g. highway=motorway, ref=M25
-  
-- Polygon contains ways which form an enclosed area
-  e.g. landuse=reservoir
-
-The DB columns are used as follows:
-- osm_id = the planet.osm ID of the node(point) or way(line,polygon)
-- name, place, landuse, ... = the value of the given key, if present on
-the node/way. If the tag is not present, the value is NULL. Only a
-subset of all possible tags are stored in the DB. Only ones rendered in
-the osm.xml are actually interesting to mapnik.
-- way = PostGIS geometry describing the physical layout of the object.
-
-Querying specific data requires knowlege of SQL and the OSM key/value
-system, e.g.
-
-gis=> select osm_id,astext(way),name from planet_osm_point where amenity='cinema' limit 5;
-  osm_id  |                  astext                   |        name
-----------+-------------------------------------------+--------------------
- 26236284 | POINT(-79.7160836579093 43.6802306464618) |
- 26206699 | POINT(51.4051989797638 35.7066045032235)  | Cinema Felestin
- 26206700 | POINT(51.3994885141459 35.7058460359352)  | Cinema Asr-e Jadid
- 20979630 | POINT(151.225781789807 -33.8943079539886) | Paris Cinema
- 20979684 | POINT(151.226855394904 -33.8946830511095) | Hoyts
-(5 rows)
-
-Mapnik renders the data in each table by applying the rules in the
-osm.xml file.
-
-
-> How could I get e.g. all highways in a given bounding box?
-
-The 'way' column contains the geo info and is the one which you need to
-use in your WHERE clause. e.g.
-
-gis=> select osm_id,highway,name from planet_osm_line where highway is not null and way && GeomFromText('POLYGON((0 52, 0.1 52, 0.1 52.1, 0 52.1, 0 52))',4326);
- 
-osm_id  |   highway    |       name
----------+--------------+------------------
- 4273848 | unclassified |
- 3977133 | trunk        | to Royston (tbc)
- 4004841 | trunk        |
- 4019198 | trunk        |
- 4019199 | trunk        |
- 4238966 | unclassified |
-
-See the Postgis docs for details, e.g.
-http://postgis.net/docs/manual-2.0/reference.html
diff --git a/README b/README
new file mode 120000
index 0000000..42061c0
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.md
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a79525b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,136 @@
+# osm2pgsql #
+
+osm2pgsql is a tool for loading OpenStreetMap data into a PostgreSQL / PostGIS
+database suitable for applications like rendering into a map, geocoding with
+Nominatim, or general analysis.
+
+## Features ##
+
+* Converts OSM files to a PostgreSQL DB
+* Conversion of tags to columns is configurable in the style file
+* Able to read .gz, .bz2, .pbf and .o5m files directly
+* Can apply diffs to keep the database up to date
+* Support the choice of output projection
+* Configurable table names
+* Gazetteer back-end for [Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim)
+* Support for hstore field type to store the complete set of tags in one database
+  field if desired
+
+## Installing ##
+
+The latest source code is available in the OSM git repository on github
+and can be downloaded as follows:
+
+```sh
+$ git clone git://github.com/openstreetmap/osm2pgsql.git
+```
+
+## Building ##
+
+Osm2pgsql uses the [GNU Build System](http://www.gnu.org/software/automake/manual/html_node/GNU-Build-System.html)
+to configure and build itself and requires 
+
+* [libxml2](http://xmlsoft.org/)
+* [geos](http://geos.osgeo.org/)
+* [proj](http://proj.osgeo.org/)
+* [bzip2](http://www.bzip.org/)
+* [zlib](http://www.zlib.net/)
+* [Protocol Buffers](https://developers.google.com/protocol-buffers/)
+* [PostgreSQL](http://www.postgresql.org/) client libraries
+* [Lua](http://www.lua.org/) (Optional, used for [Lua tag transforms](docs/lua.md))
+
+It also requires access to a database server running
+[PostgreSQL](http://www.postgresql.org/) and [PostGIS](http://www.postgis.net/).
+
+Make sure you have installed the development packages for the 
+libraries mentioned in the requirements section and a C and C++
+compiler.
+
+To install on a Debian or Ubuntu system, first install the prerequisites:
+
+```sh
+sudo apt-get install autoconf automake libtool make g++ libxml2-dev libgeos-dev
+  libgeos++-dev libpq-dev libbz2-dev libproj-dev protobuf-c-compiler
+  libprotobuf-c0-dev lua5.2 liblua5.2-dev
+```
+
+To install on a Fedora system, use
+
+```sh
+sudo yum install gcc-c++ libxml2-devel geos-develpostgresql-devel bzip2-devel
+  proj-devel protobuf-compiler
+```
+
+Then you should be able to bootstrap the build system:
+
+    ./autogen.sh
+
+And then run the standard GNU build install:
+
+    ./configure && make && make install
+
+Please see `./configure --help` for more options on how to control the build
+process.
+
+## Usage ##
+
+Osm2pgsql has one program, the executable itself, which has **43** command line
+options.
+
+Before loading into a database, the database must be created and the PostGIS
+and optionally hstore extensions must be loaded. A full guide to PostgreSQL
+setup is beyond the scope of this readme, but with reasonably recent versions
+of PostgreSQL and PostGIS this can be done with
+
+```sh
+createdb gis
+psql -d gis -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'
+```
+
+A basic invocation to load the data into the database ``gis`` for rendering would be
+
+```sh
+osm2pgsql --create --database gis data.osm.pbf
+```
+
+This will load the data from ``data.osm.pbf`` into the ``planet_osm_point``,
+``planet_osm_line``, ``planet_osm_roads``, and ``planet_osm_polygon`` tables.
+
+When importing a large amount of data such as the complete planet, a typical
+command line would be
+
+```sh
+    osm2pgsql -c -d gis --slim -C <cache size> \
+      --flat-nodes <flat nodes> planet-latest.osm.pbf
+```
+where
+* ``<cache size>`` is 24000 on machines with 32GiB or more RAM
+  or about 75% of memory in MiB on machines with less
+* ``<flat nodes>`` is a location where a 24GiB file can be saved.
+
+The databases from either of these commands can be used immediately by
+[Mapnik](http://mapnik.org/) for rendering maps with standard tools like
+[renderd/mod_tile](https://github.com/openstreetmap/mod_tile),
+[TileMill](https://www.mapbox.com/tilemill/), [Nik4](https://github.com/Zverik/Nik4),
+among others. It can also be used for [spatial analysis](docs/analysis.md) or
+[shapefile exports](docs/export.md).
+
+[Additional documentation is available on writing command lines](docs/usage.md).
+
+## Alternate backends ##
+
+In addition to the standard [pgsql](docs/pgsql.md) backend designed for
+rendering there is also the [gazetteer](docs/gazetteer.md) database for
+geocoding, principally with [Nominatim](http://www.nominatim.org/), and the
+null backend for testing.
+
+Any questions should be directed at the osm dev list
+http://wiki.openstreetmap.org/index.php/Mailing_lists
+
+## Contributing ##
+
+We welcome contributions to osm2pgsql. If you would like to report an issue,
+please use the [issue tracker on GitHub](https://github.com/openstreetmap/osm2pgsql/issues).
+
+General queries can be sent to the tile-serving@ or dev@
+[mailing lists](http://wiki.openstreetmap.org/wiki/Mailing_lists).
diff --git a/binarysearcharray.c b/binarysearcharray.c
index 750c418..237ddfa 100644
--- a/binarysearcharray.c
+++ b/binarysearcharray.c
@@ -45,7 +45,6 @@ osmid_t binary_search_get(struct binary_search_array * array, int key)
     {
         return array->array[idx].value;
     }
-    exit(1);
 }
 
 void binary_search_remove(struct binary_search_array * array, int key)
diff --git a/binarysearcharray.h b/binarysearcharray.h
index 8b64aff..8ff9f5b 100644
--- a/binarysearcharray.h
+++ b/binarysearcharray.h
@@ -1,4 +1,5 @@
-
+#ifndef BINARYSEARCHARRAY_H
+#define BINARYSEARCHARRAY_H
 
 
 struct key_val_tuple {
@@ -18,3 +19,4 @@ osmid_t binary_search_get(struct binary_search_array * array, int key);
 struct binary_search_array *  init_search_array(int capacity);
 void shutdown_search_array(struct binary_search_array ** array);
 
+#endif
diff --git a/build_geometry.cpp b/build_geometry.cpp
index bb160ab..6bac59a 100644
--- a/build_geometry.cpp
+++ b/build_geometry.cpp
@@ -242,12 +242,14 @@ size_t get_wkt_split(osmNode *nodes, int count, int polygon, double split_at) {
 char * get_wkt(size_t index)
 {
 //   return wkts[index].c_str();
-	char *result;
-	result = (char*) std::malloc( wkts[index].length() + 1);
-        // At least give some idea of why we about to seg fault
-        if (!result) std::cerr << std::endl << "Unable to allocate memory: " << (wkts[index].length() + 1) << std::endl;
-	std::strcpy(result, wkts[index].c_str());
-	return result;
+    char *result;
+    result = (char*) std::malloc( wkts[index].length() + 1);
+    // At least give some idea of why we about to seg fault
+    if (!result)
+        std::cerr << std::endl << "Unable to allocate memory: " << (wkts[index].length() + 1) << std::endl;
+    else
+        std::strcpy(result, wkts[index].c_str());
+    return result;
 }
 
 double get_area(size_t index)
@@ -595,3 +597,44 @@ void exclude_broken_polygon ()
 {
     excludepoly = 1;
 }
+
+char *get_multiline_geometry(osmid_t osm_id, struct osmNode **xnodes, int *xcount) {
+    std::auto_ptr<std::vector<Geometry*> > lines(new std::vector<Geometry*>);
+    GeometryFactory gf;
+    geom_ptr geom;
+
+    try
+    {
+        for (int c=0; xnodes[c]; c++) {
+            std::auto_ptr<CoordinateSequence> coords(gf.getCoordinateSequenceFactory()->create((size_t)0, (size_t)2));
+            for (int i = 0; i < xcount[c]; i++) {
+                struct osmNode *nodes = xnodes[c];
+                Coordinate c;
+                c.x = nodes[i].lon;
+                c.y = nodes[i].lat;
+                coords->add(c, 0);
+            }
+            if (coords->getSize() > 1) {
+                geom = geom_ptr(gf.createLineString(coords.release()));
+                lines->push_back(geom.release());
+            }
+        }
+
+        geom_ptr mline (gf.createMultiLineString(lines.release()));
+        WKTWriter writer;
+
+        std::string wkt = writer.write(mline.get());
+        return strdup(wkt.c_str());
+    }
+    catch (std::exception& e)
+      {
+	std::cerr << std::endl << "Standard exception processing relation id "<< osm_id << ": " << e.what()  << std::endl;
+      }
+    catch (...)
+      {
+        std::cerr << std::endl << "Exception caught processing relation id " << osm_id << std::endl;
+      }
+
+    return 0;
+}
+
diff --git a/build_geometry.h b/build_geometry.h
index 299431f..b13ce62 100644
--- a/build_geometry.h
+++ b/build_geometry.h
@@ -39,6 +39,7 @@ double get_area(size_t index);
 size_t build_geometry(osmid_t osm_id, struct osmNode **xnodes, int *xcount, int make_polygon, int enable_multi, double split_at);
 void clear_wkts();
 void exclude_broken_polygon ();
+char *get_multiline_geometry(osmid_t osm_id, struct osmNode **xnodes, int *xcount);
 
 #ifdef __cplusplus
 }
diff --git a/configure.ac b/configure.ac
index 25ad2f9..bdefcd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,14 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(osm2pgsql, 0.84.0)
+AC_INIT(osm2pgsql, 0.86.0)
 
 dnl Required autoconf version
 AC_PREREQ(2.61)
 
 AX_CONFIG_NICE
 
+dnl Allow maintainer mode to be disabled (debian build scripts do this)
+AM_MAINTAINER_MODE([enable])
+
 dnl use automake to generate standard Makefiles
 AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 std-options check-news])
 
diff --git a/docs/analysis.md b/docs/analysis.md
new file mode 100644
index 0000000..aca1059
--- /dev/null
+++ b/docs/analysis.md
@@ -0,0 +1,81 @@
+# Geospatial analysis with osm2pgsql #
+
+An osm2pgsql database and PostGIS is well-suited for geospatial analysis using
+OpenStreetMap data where topology is not a consideration.
+
+PostGIS provides an [extensive number of geometry functions](http://postgis.net/docs/manual-2.1/reference.html)
+and a full description of how to perform analysis with them is beyond the
+scope of a readme, but a simple example of finding the total road lengths by
+classification for a municipality should help.
+
+To start with, we'll download the data for the region as an [extract from Geofabrik](http://download.geofabrik.de/) and import it with osm2pgsql.
+
+    osm2pgsql --database gis --number-processes 4 --multi-geometry british-columbia-latest.osm.pbf
+
+``--multi-geometry`` (``-G``) is necessary for most analysis as it prevents
+MULTIPOLYGONs from being split into multiple POLYGONs, a step that is
+normally used to [increase rendering speed](http://paulnorman.ca/blog/2014/03/osm2pgsql-multipolygons)
+but increases the complexity of analysis SQL.
+
+Loading should take about 10 minutes, depending on computer speed. Once this
+is done we'll open a PostgreSQL terminal with ``psql -d gis``, although a GUI
+like pgadmin or any standard tool could be used instead.
+
+To start, we'll create a partial index to speed up highway queries.
+
+```sql
+CREATE INDEX planet_osm_line_highways_index ON planet_osm_line USING GiST (way) WHERE (highway IS NOT NULL);
+```
+
+We'll first find the ID of the polygon we want
+
+```sql
+gis=# SELECT osm_id FROM planet_osm_polygon
+WHERE boundary='administrative' AND admin_level='8' AND name='New Westminster';
+  osm_id
+----------
+ -1377803
+```
+
+The negative sign tells us that the geometry is from a relation, and checking
+on [the OpenStreetMap site](https://www.openstreetmap.org/relation/1377803)
+confirms which it is.
+
+We want to find all the roads in the city and get the length of the portion in
+the city, sorted by road classification. Roads are in the ``planet_osm_line``
+table, not the ``planet_osm_roads`` table which is only has a subset of data
+for low-zoom rendering.
+
+```sql
+gis=# SELECT
+    round(SUM(
+      ST_Length(ST_Transform(
+        ST_Intersection(way, (SELECT way FROM planet_osm_polygon WHERE osm_id=-1377803))
+        ,4326)::geography)
+    )) AS "distance (meters)", highway AS "highway type"
+  FROM planet_osm_line
+  WHERE highway IS NOT NULL
+  AND ST_Intersects(way, (SELECT way FROM planet_osm_polygon WHERE osm_id=-1377803))
+  GROUP BY highway
+  ORDER BY "distance (meters)" DESC
+  LIMIT 10;
+ distance (meters) | highway type
+-------------------+---------------
+            138122 | residential
+             79519 | service
+             51890 | footway
+             25610 | tertiary
+             23434 | secondary
+             14900 | cycleway
+              6468 | primary
+              5217 | motorway
+              4389 | motorway_link
+              3728 | track
+```
+
+The ``ST_Transform(...,4326)::geography`` is necessary because the data was
+imported in Mercator. This step could have been avoided by importing in a local
+projection like a suitable UTM projection.
+
+More complicated analysises can be completed, but this simple example shows how
+to use the tables and put conditions on the columns.
\ No newline at end of file
diff --git a/docs/export.md b/docs/export.md
new file mode 100644
index 0000000..ae38ded
--- /dev/null
+++ b/docs/export.md
@@ -0,0 +1,12 @@
+# Exporting with osm2pgsql #
+
+Osm2pgsql can be used in combination with [ogr2ogr](http://www.gdal.org/ogr2ogr.html) and a [PostgreSQL data source](http://www.gdal.org/drv_pg.html).
+
+An example command to export to GeoJSON would be
+
+    ogr2ogr -f "GeoJSON" roads.geojson -t_srs EPSG:4326 \
+      PG:"dbname=gis" -s_srs EPSG:900913 \
+      -sql "SELECT name,highway,oneway,toll,way FROM planet_osm_line WHERE highway IS NOT NULL"
+
+Care should be taken if exporting to shapefiles, as characters may be present
+which cannot be represented in ISO-8859-1, the standard encoding for shapefiles.
diff --git a/docs/gazetteer.md b/docs/gazetteer.md
new file mode 100644
index 0000000..b648442
--- /dev/null
+++ b/docs/gazetteer.md
@@ -0,0 +1,7 @@
+# Gazetteer Backend #
+
+The gazetteer backend is designed for use with
+[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim)
+and will not generally be used outside that context.
+
+The tables are designed for a hiarchy of places.
diff --git a/README_lua.md b/docs/lua.md
similarity index 100%
rename from README_lua.md
rename to docs/lua.md
diff --git a/docs/osm2pgsql.1 b/docs/osm2pgsql.1
index 862dfec..9aeffc3 100644
--- a/docs/osm2pgsql.1
+++ b/docs/osm2pgsql.1
@@ -36,7 +36,7 @@ database up to date.
 .PP
 .SH OPTIONS
 These programs follow the usual GNU command line syntax, with long
-options starting with two dashes (`-').
+options starting with two dashes (`\-').
 A summary of options is included below.
 .TP
 \fB\-a\fR|\-\-append
@@ -58,7 +58,7 @@ to (default: gis).
 .TP
 \fB\-i\fR|\-\-tablespace\-index tablespacename
 Store all indices in a separate PostgreSQL tablespace named by this parameter.
-This allows to e.g. store the indices on faster storage like SSDs.
+This allows one to e.g. store the indices on faster storage like SSDs.
 .TP
 \fB\ \fR\-\-tablespace\-main\-data tablespacename
 Store the data tables (non slim) in the given tablespace.
@@ -85,7 +85,7 @@ Store data in the legacy OSM Mercator format.
 Use projection EPSG:num
 .TP
 \fB\-u\fR|\-\-utf8\-sanitize
-Repair bad UTF-8 input data (present in planet
+Repair bad UTF\-8 input data (present in planet
 dumps prior to August 2007). Adds about 10% overhead.
 .TP
 \fB\-p\fR|\-\-prefix prefix_string
@@ -119,11 +119,11 @@ imported into database columns and which tags get dropped. Defaults to /usr/shar
 \fB\-C\fR|\-\-cache num
 Only for slim mode: Use up to num many MB of RAM for caching nodes. Giving osm2pgsql sufficient cache
 to store all imported nodes typically greatly increases the speed of the import. Each cached node
-requires 8 bytes of cache, plus about 10% - 30% overhead. For a current OSM full planet import with
+requires 8 bytes of cache, plus about 10% \- 30% overhead. For a current OSM full planet import with
 its ~ 1.9 billion nodes, a good value would be 17000 if you have enough RAM. If you don't have enough
 RAM, it is likely beneficial to give osm2pgsql close to the full available amount of RAM. Defaults to 800. 
 .TP
-\fB\  \fR\-\-cache-strategy strategy
+\fB\  \fR\-\-cache\-strategy strategy
 There are a number of different modes in which osm2pgsql can organize its
 node cache in RAM. These are optimized for different assumptions of the data
 and the hardware resources available. Currently available strategies are
@@ -150,16 +150,16 @@ Database server hostname or socket location.
 \fB\-P\fR|\-\-port num
 Database server port.
 .TP
-\fB\-e\fR|\-\-expire-tiles [min_zoom-]max-zoom 
+\fB\-e\fR|\-\-expire\-tiles [min_zoom\-]max\-zoom
 Create a tile expiry list.
 .TP
-\fB\-o\fR|\-\-expire-output /path/to/expire.list
+\fB\-o\fR|\-\-expire\-output /path/to/expire.list
 Output file name for expired tiles list.
 .TP
 \fB\-o\fR|\-\-output
-Specifies the output back-end or database schema to use. Currently
+Specifies the output back\-end or database schema to use. Currently
 osm2pgsql supports \fBpgsql\fR, \fBgazetteer\fR and \fBnull\fR. \fBpgsql\fR is
-the default output back-end / schema and is optimized for rendering with Mapnik.
+the default output back\-end / schema and is optimized for rendering with Mapnik.
 \fBgazetteer\fR is a db schema optimized for geocoding and is used by Nominatim.
 \fBnull\fR does not write any output and is only useful for testing.
 .TP
@@ -176,27 +176,27 @@ Add all tags to an additional hstore (key/value) column in PostgreSQL tables.
 .TP
 \fB\-z\fR|\-\-hstore\-column key_name
 Add an additional hstore (key/value) column containing all tags
-that start with the specified string, egg --hstore-column "name:" will
+that start with the specified string, eg \-\-hstore\-column "name:" will
 produce an extra hstore column that contains all name:xx tags
 .TP
 \fB\  \fR\-\-hstore\-match\-only
 Only keep objects that have a value in one of the columns
-(normal action with --hstore is to keep all objects).
+(normal action with \-\-hstore is to keep all objects).
 .TP
-\fB\  \fR\-\-hstore-add-index
+\fB\  \fR\-\-hstore\-add\-index
 Create indices for the hstore columns during import.
 .TP
 \fB\-G\fR|\-\-melts\-geometry
-Normally osm2pgsql splits multi-part geometries into separate database rows per part.
+Normally osm2pgsql splits multi\-part geometries into separate database rows per part.
 A single OSM id can therefore have several rows. With this option, PostgreSQL instead
-generates multi-geometry features in the PostgreSQL tables.
+generates multi\-geometry features in the PostgreSQL tables.
 .TP
-\fB\-K\fR|\-\-keep-coastlines
+\fB\-K\fR|\-\-keep\-coastlines
 Keep coastline data rather than filtering it out.
 By default natural=coastline tagged data will be discarded based on the
 assumption that post-processed Coastline Checker shape files will be used.
 .TP
-\fB\  \fR\-\-exclude-invalid-polygon
+\fB\  \fR\-\-exclude\-invalid\-polygon
 OpenStreetMap data is defined in terms of nodes, ways and relations and not in
 terms of actual geometric features. Osm2pgsql therefore tries to build postgis
 geometries out of this data representation. However not all ways and relations
@@ -207,31 +207,31 @@ simply dropped from the database.
 .TP
 \fB\  \fR\-\-unlogged
 Use postgresql's unlogged tables for storing data. This requires PostgreSQL 9.1
-or above. Data written to unlogged tables is not written to PostgreSQL's write-ahead log,
+or above. Data written to unlogged tables is not written to PostgreSQL's write\-ahead log,
 which makes them considerably faster than ordinary tables. However, they are not
-crash-safe: an unlogged table is automatically truncated after a crash or unclean shutdown.
+crash\-safe: an unlogged table is automatically truncated after a crash or unclean shutdown.
 .TP
 \fB\  \fR\-\-number\-processes num
 Specifies the number of parallel processes used for certain operations. If disks are
 fast enough e.g. if you have an SSD, then this can greatly increase speed of
-the "going over pending ways" and "going over pending relations" stages on a multi-core
-server. 
+the "going over pending ways" and "going over pending relations" stages on a multi\-core
+server.
 .TP
-\fB\-I\fR|\-\-disable-parallel-indexing
+\fB\-I\fR|\-\-disable\-parallel\-indexing
 By default osm2pgsql initiates the index building on all tables in parallel to increase
 performance. This can be disadvantages on slow disks, or if you don't have
 enough RAM for PostgreSQL to perform up to 7 parallel index building processes
 (e.g. because maintenance_work_mem is set high).
 .TP
-\fB\  \fR\-\-flat-nodes /path/to/nodes.cache
-The flat-nodes mode is a separate method to store slim mode node information on disk.
+\fB\  \fR\-\-flat\-nodes /path/to/nodes.cache
+The flat\-nodes mode is a separate method to store slim mode node information on disk.
 Instead of storing this information in the main PostgreSQL database, this mode creates
 its own separate custom database to store the information. As this custom database
 has application level knowledge about the data to store and is not general purpose,
 it can store the data much more efficiently. Storing the node information for the full
 planet requires about 100GB in PostgreSQL, the same data is stored in only ~16GB using
-the flat-nodes mode. This can also increase the speed of applying diff files. This option
-activates the flat-nodes mode and specifies the location of the database file. It is a
+the flat\-nodes mode. This can also increase the speed of applying diff files. This option
+activates the flat\-nodes mode and specifies the location of the database file. It is a
 single large > 16GB file. This mode is only recommended for full planet imports
 as it doesn't work well with small extracts. The default is disabled.
 .TP
@@ -244,11 +244,11 @@ Add \fB\-v\fR to display supported projections.
 Verbose output.
 .PP
 .SH SUPPORTED PROJECTIONS
-Latlong             (-l) SRS:  4326 (none)
-.br       
+Latlong             (\-l) SRS:  4326 (none)
+.br
 WGS84 Mercator      (  ) SRS:  3395 +proj=merc +datum=WGS84  +k=1.0 +units=m +over +no_defs
 .br
-Spherical Mercator  (-m) SRS:900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over
+Spherical Mercator  (\-m) SRS:900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over
 .PP
 .SH SEE ALSO
 .BR proj (1),
diff --git a/docs/pgsql.md b/docs/pgsql.md
new file mode 100644
index 0000000..2ba1a5b
--- /dev/null
+++ b/docs/pgsql.md
@@ -0,0 +1,54 @@
+# Pgsql Backend #
+
+The pgsql backend is designed for rendering OpenStreetMap data, principally
+with Mapnik, but is also useful for [analysis](docs/analysis.md) and
+[exporting](docs/exporting.md) to other formats.
+
+## Database Layout ##
+It connects to a PostgreSQL database and stores the data in four tables
+
+* ``planet_osm_point``
+* ``planet_osm_line``
+* ``planet_osm_roads``
+* ``planet_osm_polygon``
+
+planet_osm_roads contains the data from other tables, but has tags selected
+for low-zoom rendering. It does not only contain roads.
+
+The default prefix ``planet_osm`` can be changed with the ``--prefix`` option.
+
+If you are using ``--slim`` mode, it will create the following additional 3
+tables which are used by the pgsql middle layer, not the backend:
+
+* ``planet_osm_nodes``
+* ``planet_osm_ways``
+* ``planet_osm_rels``
+
+With the ``--flat-nodes`` option, the ``planet_osm_nodes`` information is
+instead stored in a binary file.
+
+## Importing ##
+
+1. Runs a parser on the input file and processes the nodes, ways and relations.
+
+2. If a node has a tag declared in the style file then it is added to
+   ``planet_osm_point``. Regardless of tags, its position is stored by the
+   middle layer.
+
+3. If there are tags on a way in the style file as linear but without polygon
+   tags, they are written into the lines and, depending on tags, roads tables.
+   
+   They are also stored by the middle layer.
+
+4. Ways without tags or with polygon tags are stored as "pending" in the
+   middle layer.
+
+5. Relations are parsed. In this stage, "new-style" multipolygon and boundary
+   relations are turned into polygons. Route relations are turned into
+   linestrings.
+
+6. "Pending" ways are processed, and they are either added as just the way, or
+   if a member of a multipolygon relation, they processed as multipolygons.
+
+7. Indexes are built. This may take substantial time, particularly for the
+   middle layer indexes created in non-slim mode.
diff --git a/docs/usage.md b/docs/usage.md
new file mode 100644
index 0000000..1e978c2
--- /dev/null
+++ b/docs/usage.md
@@ -0,0 +1,146 @@
+# Command-line usage #
+
+Osm2pgsql has one program, the executable itself, which has **43** command line
+options. A full list of options can be obtained with ``osm2pgsql -h -v``. This
+document provides an overview of options, and more importantly, why you might
+use them.
+
+## Overall options
+
+* ``--append`` or ``--create`` specify if osm2pgsql is conducting a new import
+  or adding to an existing one. ``--slim`` is required with ``--append``.
+
+* ``--input-reader`` specifies the parser if the filetype can't be
+  automatically detected for some reason. The ``primitive`` parser is **not**
+  suggested.
+
+* ``--output`` specifies if the output backend is the default
+  [pgsql](pgsql.md), the [gazetteer](gazetteer.md) output used by Nominatim, or
+  null, which emits no output.
+
+## Performance
+
+Performance is heavily influenced by other options, but there are some options
+that only impact performance.
+
+* ``--cache`` specifies how much memory to allocate for caching information. In
+  ``--slim`` mode, this is just node positions while in non-slim it has to
+  store information about ways and relations too. The maximum RAM it is useful
+  to set this to in slim mode is 8 bytes * number of nodes / efficiency, where
+  efficiency ranges from 50% on small extracts to 80% for a planet.
+  
+* ``--number-processes`` sets the number of processes to use. This should
+  typically be set to the number of CPU threads, but gains in speed are minimal
+  past 8 threads.
+
+* ``--disable-parallel-indexing`` disables the clustering and indexing of all
+  tables in parallel. This reduces disk and ram requirements during the import,
+  but causes the last stages to take significantly longer.
+
+* ``--cache-strategy`` sets the cache strategy to use. The defaults are fine
+  here, and optimizied uses less RAM than the other options.
+  
+## Database options ##
+
+osm2pgsql supports standard options for how to connect to PostgreSQL. If left
+unset, it will attempt to connect to the ``gis`` database using a unix socket.
+Most usage only requires setting ``--database``.
+
+``--tablespace`` options allow the location of main and slim tables and indexes
+to be set to different tablespaces independently, typically on machines with
+multiple drive arrays where one is not large enough for all of the database.
+
+``--flat-nodes`` specifies that instead of a table in PostgreSQL, a binary
+file is used as a database of node locations. This should only be used on full
+planet imports or very large extracts (e.g. Europe) but in those situations
+offers significant space savings and speed increases, particularly on
+mechanical drives. The file takes approximately 8 bytes * maximum node ID, or
+about 23 GiB, regardless of the size of the extract.
+
+``--unlogged`` specifies to use unlogged tables which are dropped from the
+database if the database server ever crashes, but are faster to import.
+
+``--prefix`` specifies the prefix for tables
+
+## Middle-layer options ##
+
+* ``--slim`` causes the middle layer to store node and way information in
+  database rather than in memory. It is required for updates and for large
+  extracts or the entire planet which will not fit in RAM.
+  
+* ``--drop`` discards the slim tables when they are no longer needed in the
+  import, significantly reducing disk requirements and saving the time of
+  building slim table indexes. A ``--slim --drop``
+
+## Output columns options ##
+
+### Column options
+
+* ``--extra-attributes`` creates psudo-tags with OSM meta-data like user,
+  last edited, and changeset. These also need to be added to the style file.
+
+* ``--style`` specifies the location of the style file. This defines what
+  columns are created, what tags denote areas, and what tags can be ignored.
+  The [default.style](../default.style) contains more documentation on this
+  file.
+
+* ``--tag-transform-script`` sets a [Lua tag transform](lua.md) to use in
+  place of the built-in C tag transform.
+
+### Hstore
+
+Hstore is a [PostgreSQL data type](http://www.postgresql.org/docs/9.3/static/hstore.html)
+that allows storing arbitrary key-value pairs. It needs to be installed on
+the database with ``CREATE EXTENSION hstore;``
+
+osm2pgsql has five hstore options
+
+* ``--hstore`` or ``-k`` adds any tags not already in a conventional column to
+  a hstore column. With the standard stylesheet this would result in tags like
+  highway appearing in a conventional column while tags not in the style like
+  ``name:en`` or ``lanes:forward`` would appear only in the hstore column.
+  
+* ``--hstore-all`` or ``-j`` adds all tags to a hstore column, even if they're
+  already stored in a conventional column. With the standard stylesheet this
+  would result in tags like highway appearing in conventional column and the
+  hstore column while tags not in the style like ``name:en`` or
+  ``lanes:forward`` would appear only in the hstore column.
+  
+* ``--hstore-column`` or ``-z``, which adds an additional column for tags
+  starting with a specified string, e.g. ``--hstore-column 'name:'`` produces
+  a hstore column that contains all ``name:xx`` tags
+  
+* ``--hstore-match-only`` modifies the above options and prevents objects from
+  being added if they only have tags in the hstore column and no conventional
+  tags.
+  
+* ``--hstore-add-index`` adds a GIN index to the hstore columns. This can
+  speed up arbitrary queries, but for most purposes partial indexes will be
+  faster.
+
+Either ``--hstore`` or ``--hstore-all`` when combined with ``--hstore-match-only``
+should give the same rows as no hstore, just with the additional hstore column.
+
+Hstore is used to give more flexability to use additional tags without
+reimporting the database, at the cost of a
+[less speed and more space.](http://paulnorman.ca/blog/2014/03/osm2pgsql-and-hstore/)
+
+## Projection options
+
+* ``--latlong``, ``--merc``, or ``--proj`` are used to specify the projection
+  used for importing. The default, ``--merc`` is typically used for rendering,
+  while ``--latlong`` can offer advantages for analysis. Most stylesheets
+  assume ``--merc`` has been used.
+
+## Output data options
+
+* ``--multi-geometry`` skips an optimization for rendering where PostGIS
+  MULTIPOLYGONs are split into multiple POLYGONs. ``--multi-geometry`` can be
+  used to [avoid some labeling issues at the cost of speed](http://paulnorman.ca/blog/2014/03/osm2pgsql-multipolygons/).
+  It is also typically required for [analysis](analysis.md).
+  
+* ``--keep-coastlines`` disables a hard-coded rule that would otherwise
+  discard ``natural=coastline`` ways.
+
+* ``--exclude-invalid-polygon`` prevents osm2pgsql from attempting to form
+  valid polygons from invalid ones and just rejects the invalid ones.
diff --git a/install-postgis-osm-db.sh b/install-postgis-osm-db.sh
index d76a1c0..34e16f8 100755
--- a/install-postgis-osm-db.sh
+++ b/install-postgis-osm-db.sh
@@ -21,7 +21,12 @@ fi
 
     sudo -u postgres createlang plpgsql $DBNAME || true
 
-    if [ -e /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql ] ; then
+    if [ -e /usr/share/postgresql/9.3/extension/postgis.control ]; then
+        echo "Initializing Spatial Extentions for postgresql 9.3"
+        echo "CREATE EXTENSION postgis;" | sudo -u postgres psql $DBNAME
+        echo "Initializing hstore"
+        echo "CREATE EXTENSION hstore;" | sudo -u postgres psql $DBNAME
+    else if [ -e /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql ] ; then
         echo "Initializing Spatial Extentions for postgresql 9.1"
         file_postgis=/usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
         file_spatial_ref=/usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
@@ -44,7 +49,7 @@ fi
         echo "Initializing hstore"
         file_hstore=/usr/share/postgresql/8.4/contrib/hstore.sql
         sudo -u postgres psql $DBNAME <$file_hstore >/dev/null 2>&1
-    fi
+    fi fi
     
     echo "Setting ownership to user $DBOWNER"
 
diff --git a/m4/ax_lib_geos.m4 b/m4/ax_lib_geos.m4
index 31eb07a..6ff4fe3 100644
--- a/m4/ax_lib_geos.m4
+++ b/m4/ax_lib_geos.m4
@@ -90,10 +90,10 @@ AC_DEFUN([AX_LIB_GEOS],
             GEOS_VERSION=`$GEOS_CONFIG --version`
 
             dnl Headers are in a different package in Debian, so check again.
+            ac_save_CPPFLAGS="$CPPFLAGS"
             CPPFLAGS="$CPPFLAGS $GEOS_CFLAGS"
             AC_CHECK_HEADER([geos/version.h], [],
                              [AC_MSG_ERROR([development headers for geos not found])])
-            echo $ac_save_CPPFLAGS
             CPPFLAGS="$ac_save_CPPFLAGS"
 
             AC_DEFINE([HAVE_GEOS], [1],
diff --git a/m4/ax_lib_protobuf_c.m4 b/m4/ax_lib_protobuf_c.m4
index 85bae65..38fb151 100644
--- a/m4/ax_lib_protobuf_c.m4
+++ b/m4/ax_lib_protobuf_c.m4
@@ -207,7 +207,9 @@ AC_DEFUN([AX_LIB_PROTOBUF_C],
       CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS"
       AX_COMPARE_VERSION([$protobuf_c_wanted_version], [ge], [0.14],
          [AC_CHECK_MEMBER([ProtobufCFieldDescriptor.packed],,
-                          [protobuf_c_version_ok="no"],
+                          [AC_CHECK_MEMBER([ProtobufCFieldDescriptor.flags],,
+                                           [protobuf_c_version_ok="no"],
+                                           [[#include <protobuf-c/protobuf-c.h>]])],
                           [[#include <google/protobuf-c/protobuf-c.h>]
          ])
       ])
diff --git a/middle-pgsql.c b/middle-pgsql.c
index 5c87440..5eaa8be 100644
--- a/middle-pgsql.c
+++ b/middle-pgsql.c
@@ -85,7 +85,7 @@ static struct table_desc tables [] = {
       .prepare = "PREPARE insert_node (" POSTGRES_OSMID_TYPE ", double precision, double precision, text[]) AS INSERT INTO %p_nodes VALUES ($1,$2,$3,$4);\n"
 #endif
                "PREPARE get_node (" POSTGRES_OSMID_TYPE ") AS SELECT lat,lon,tags FROM %p_nodes WHERE id = $1 LIMIT 1;\n"
-               "PREPARE get_node_list(" POSTGRES_OSMID_TYPE "[]) AS SELECT id, lat, lon FROM %p_nodes WHERE id = ANY($1::" POSTGRES_OSMID_TYPE "[])",
+               "PREPARE get_node_list(" POSTGRES_OSMID_TYPE "[]) AS SELECT id, lat, lon FROM %p_nodes WHERE id = ANY($1::" POSTGRES_OSMID_TYPE "[]);\n"
                "PREPARE delete_node (" POSTGRES_OSMID_TYPE ") AS DELETE FROM %p_nodes WHERE id = $1;\n",
          .copy = "COPY %p_nodes FROM STDIN;\n",
       .analyze = "ANALYZE %p_nodes;\n",
diff --git a/node-persistent-cache.h b/node-persistent-cache.h
index babf9a5..6d30d71 100644
--- a/node-persistent-cache.h
+++ b/node-persistent-cache.h
@@ -1,3 +1,6 @@
+#ifndef NODE_PERSISTENT_CACHE_H
+#define NODE_PERSISTENT_CACHE_H
+
 #define MAXIMUM_INITIAL_ID 2600000000
 
 #define READ_NODE_CACHE_SIZE 10000
@@ -22,3 +25,5 @@ int persistent_cache_nodes_get(struct osmNode *out, osmid_t id);
 int persistent_cache_nodes_get_list(struct osmNode *nodes, osmid_t *ndids, int nd_count);
 void init_node_persistent_cache(const struct output_options *options, const int append);
 void shutdown_node_persistent_cache();
+
+#endif
diff --git a/node-ram-cache.c b/node-ram-cache.c
index 496fc17..d237760 100644
--- a/node-ram-cache.c
+++ b/node-ram-cache.c
@@ -356,7 +356,7 @@ void init_node_ram_cache( int strategy, int cacheSizeMB, int fixpointscale ) {
     cacheSize = (int64_t)cacheSizeMB*(1024*1024);
     /* How much we can fit, and make sure it's odd */
     maxBlocks = (cacheSize/(PER_BLOCK*sizeof(struct ramNode)));
-    maxSparseTuples = (cacheSize/sizeof(struct ramNodeID));
+    maxSparseTuples = (cacheSize/sizeof(struct ramNodeID))+1;
     
     allocStrategy = strategy;
     scale = fixpointscale;
diff --git a/output-gazetteer.c b/output-gazetteer.c
index 424c8be..d90b612 100644
--- a/output-gazetteer.c
+++ b/output-gazetteer.c
@@ -237,6 +237,7 @@ static void stop_error_copy(void)
 static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *names, struct keyval *places, struct keyval *extratags, 
    int* admin_level, struct keyval ** housenumber, struct keyval ** street, struct keyval ** addr_place, char ** isin, struct keyval ** postcode, struct keyval ** countrycode)
 {
+   size_t subval;
    int placehouse = 0;
    int placebuilding = 0;
    int placeadmin = 0;
@@ -299,6 +300,7 @@ static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *na
           strcmp(item->key, "old_name") == 0 ||
           (strncmp(item->key, "old_name:", 9) == 0) || 
           strcmp(item->key, "alt_name") == 0 ||
+          (strncmp(item->key, "alt_name_", 9) == 0) || 
           (strncmp(item->key, "alt_name:", 9) == 0) || 
           strcmp(item->key, "official_name") == 0 ||
           (strncmp(item->key, "official_name:", 14) == 0) || 
@@ -362,8 +364,7 @@ static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *na
                strcmp(item->key, "office") == 0 ||
                strcmp(item->key, "railway") == 0 ||
                strcmp(item->key, "shop") == 0 ||
-               strcmp(item->key, "tunnel") == 0 ||
-               strcmp(item->key, "waterway") == 0 )
+               strcmp(item->key, "tunnel") == 0 )
       {
          if (strcmp(item->value, "no"))
          {
@@ -378,6 +379,11 @@ static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *na
             freeItem(item);
          }
       }
+      else if (strcmp(item->key, "waterway") == 0 &&
+               strcmp(item->value, "riverbank") != 0)
+      {
+            pushItem(places, item);
+      }
       else if (strcmp(item->key, "place") == 0) 
       {
          place = item;
@@ -467,11 +473,24 @@ static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *na
              addItem(places, "place", "houses", 1);
           }
       }
+      else if (strcmp(item->key, "tiger:county") == 0)
+      {
+         /* strip the state and replace it with a county suffix to ensure that
+            the tag only matches against counties and not against some town
+            with the same name.
+          */
+         subval = strcspn(item->value, ",");
+         *isin = realloc(*isin, isinsize + 9 + subval);
+         *(*isin+isinsize) = ',';
+         strncpy(*isin+1+isinsize, item->value, subval);
+         strcpy(*isin+1+isinsize+subval, " county");
+         isinsize += 8 + subval;
+         freeItem(item);
+      }
       else if (strcmp(item->key, "is_in") == 0 ||
           (strncmp(item->key, "is_in:", 5) == 0) ||
-          strcmp(item->key, "addr:country")== 0 ||
+          strcmp(item->key, "addr:suburb")== 0 ||
           strcmp(item->key, "addr:county")== 0 ||
-          strcmp(item->key, "tiger:county")== 0 ||
           strcmp(item->key, "addr:city") == 0 ||
           strcmp(item->key, "addr:state_code") == 0 ||
           strcmp(item->key, "addr:state") == 0)
@@ -642,13 +661,13 @@ static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *na
 
    if (landuse)
    {
-      if (!listHasData(places))
+      if (!listHasData(places) && listHasData(names))
       {
           pushItem(places, landuse);
       }
       else
       {
-          freeItem(item);
+          freeItem(landuse);
       }
    }
 
@@ -1221,6 +1240,7 @@ static int gazetteer_process_relation(osmid_t id, struct member *members, int me
    struct keyval * countrycode;
    int wkt_size;
    const char *type;
+   int cmp_waterway;
 
    type = getItem(tags, "type");
    if (!type) {
@@ -1228,14 +1248,16 @@ static int gazetteer_process_relation(osmid_t id, struct member *members, int me
       return 0;
    }
 
-   if (!strcmp(type, "associatedStreet") || !strcmp(type, "relatedStreet"))
+   cmp_waterway = strcmp(type, "waterway");
+
+   if (!strcmp(type, "associatedStreet"))
    {
       Options->mid->relations_set(id, members, member_count, tags);
       if (delete_old) delete_unused_classes('R', id, 0); 
       return 0;
    }
 
-   if (strcmp(type, "boundary") && strcmp(type, "multipolygon")) {
+   if (strcmp(type, "boundary") && strcmp(type, "multipolygon") && cmp_waterway) {
       if (delete_old) delete_unused_classes('R', id, 0); 
       return 0;
    }
@@ -1268,29 +1290,53 @@ static int gazetteer_process_relation(osmid_t id, struct member *members, int me
          count++;
       }
 
+      if (count == 0)
+      {
+          if (delete_old) delete_unused_classes('R', id, 0);
+          free(xcount);
+          free(xtags);
+          free(xnodes);
+          free(xid2);
+          return 0;
+      }
+
       count = Options->mid->ways_get_list(xid2, count, &xid, xtags, xnodes, xcount);
 
       xnodes[count] = NULL;
       xcount[count] = 0;
 
-      wkt_size = build_geometry(id, xnodes, xcount, 1, 1, 1000000);
-      for (i=0;i<wkt_size;i++)
+      if (cmp_waterway)
       {
-         char *wkt = get_wkt(i);
-         if (strlen(wkt) && (!strncmp(wkt, "POLYGON", strlen("POLYGON")) || !strncmp(wkt, "MULTIPOLYGON", strlen("MULTIPOLYGON"))))
-         {
-             for (place = firstItem(&places); place; place = nextItem(&places, place))
+          wkt_size = build_geometry(id, xnodes, xcount, 1, 1, 1000000);
+          for (i=0;i<wkt_size;i++)
+          {
+             char *wkt = get_wkt(i);
+             if (strlen(wkt) && (!strncmp(wkt, "POLYGON", strlen("POLYGON")) || !strncmp(wkt, "MULTIPOLYGON", strlen("MULTIPOLYGON"))))
              {
-                add_place('R', id, place->key, place->value, &names, &extratags, adminlevel, housenumber, street, addr_place, isin, postcode, countrycode, wkt);
+                 for (place = firstItem(&places); place; place = nextItem(&places, place))
+                 {
+                    add_place('R', id, place->key, place->value, &names, &extratags, adminlevel, housenumber, street, addr_place, isin, postcode, countrycode, wkt);
+                 }
              }
-         }
-         else
-         {
-             /* add_polygon_error('R', id, "boundary", "adminitrative", &names, countrycode, wkt); */
-         }
-         free(wkt);
+             else
+             {
+                 /* add_polygon_error('R', id, "boundary", "adminitrative", &names, countrycode, wkt); */
+             }
+             free(wkt);
+          }
+          clear_wkts();
+      } else {
+          /* waterways result in multilinestrings */
+          char *wkt = get_multiline_geometry(id, xnodes, xcount);
+          if (wkt && strlen(wkt))
+          {
+              for (place = firstItem(&places); place; place = nextItem(&places, place))
+              {
+                 add_place('R', id, place->key, place->value, &names, &extratags, adminlevel, housenumber, street, addr_place, isin, postcode, countrycode, wkt);
+              }
+          }
+          free(wkt);
       }
-      clear_wkts();
 
       for( i=0; i<count; i++ )
       {
diff --git a/output-pgsql.c b/output-pgsql.c
index a9e55a4..827ae54 100644
--- a/output-pgsql.c
+++ b/output-pgsql.c
@@ -858,7 +858,7 @@ static int pgsql_out_start(const struct output_options *options)
         }
         else
         {
-            sprintf(sql, "SELECT srid FROM geometry_columns WHERE f_table_name='%s';", tables[i].name);
+            sprintf(sql, "SELECT srid FROM geometry_columns WHERE f_table_name='%s' AND f_geometry_column='way';", tables[i].name);
             res = PQexec(sql_conn, sql);
             if (!((PQntuples(res) == 1) && (PQnfields(res) == 1)))
             {
@@ -1112,7 +1112,7 @@ static void *pgsql_out_stop_one(void *arg)
                     if (Options->slim && !Options->droptemp) {
                         pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags) TABLESPACE %s;\n", table->name, table->name, Options->tblsmain_index);
                     } else {
-                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags) WITH (FILLFACTOR=100) TABLESPACE %s;\n", table->name, table->name, Options->tblsmain_index);
+                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags) TABLESPACE %s;\n", table->name, table->name, Options->tblsmain_index);
                     }
                 }
                 for(i_column = 0; i_column < Options->n_hstore_columns; i_column++) {
@@ -1120,7 +1120,7 @@ static void *pgsql_out_stop_one(void *arg)
                         pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\") TABLESPACE %s;\n",
                                table->name, i_column,table->name, Options->hstore_columns[i_column], Options->tblsmain_index);
                     } else {
-                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\") WITH (FILLFACTOR=100) TABLESPACE %s;\n",
+                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\") TABLESPACE %s;\n",
                                table->name, i_column,table->name, Options->hstore_columns[i_column], Options->tblsmain_index);
                     }
                 }
@@ -1129,14 +1129,14 @@ static void *pgsql_out_stop_one(void *arg)
                     if (Options->slim && !Options->droptemp) {
                         pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags);\n", table->name, table->name);
                     } else {
-                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags) WITH (FILLFACTOR=100);\n", table->name, table->name);
+                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_tags_index ON %s USING GIN (tags) ;\n", table->name, table->name);
                     }
                 }
                 for(i_column = 0; i_column < Options->n_hstore_columns; i_column++) {
                     if (Options->slim && !Options->droptemp) {
                         pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\");\n", table->name, i_column,table->name, Options->hstore_columns[i_column]);
                     } else {
-                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\") WITH (FILLFACTOR=100);\n", table->name, i_column,table->name, Options->hstore_columns[i_column]);
+                        pgsql_exec(sql_conn, PGRES_COMMAND_OK, "CREATE INDEX %s_hstore_%i_index ON %s USING GIN (\"%s\");\n", table->name, i_column,table->name, Options->hstore_columns[i_column]);
                     }
                 }
             }
diff --git a/parse-o5m.h b/parse-o5m.h
index 5e2ce13..a97a261 100644
--- a/parse-o5m.h
+++ b/parse-o5m.h
@@ -23,7 +23,7 @@
 */
 
 #ifndef PARSE_O5M_H
-#define PARSE_O5M_h
+#define PARSE_O5M_H
 
 int streamFileO5m(char *filename,int sanitize,struct osmdata_t *osmdata);
 
diff --git a/parse-pbf.c b/parse-pbf.c
index 0d09df0..247ccaf 100644
--- a/parse-pbf.c
+++ b/parse-pbf.c
@@ -29,7 +29,6 @@
 #include <time.h>
 
 #include <zlib.h>
-#include <bzlib.h>
 
 #include "osmtypes.h"
 #include "output.h"
@@ -156,30 +155,8 @@ static size_t uncompress_blob(Blob *bmsg, void *buf, int32_t max_size)
 
     return bmsg->raw_size;
   } else if (bmsg->has_bzip2_data) {
-    int ret;
-    bz_stream strm;
-    strm.bzalloc = NULL;
-    strm.bzfree = NULL;
-    strm.opaque = NULL;
-    strm.avail_in = bmsg->bzip2_data.len;
-    strm.next_in = (char *) bmsg->bzip2_data.data;
-    strm.avail_out = bmsg->raw_size;
-    strm.next_out = buf;
-
-    ret = BZ2_bzDecompressInit(&strm, 0, 0);
-    if (ret != BZ_OK) {
-      fprintf(stderr, "Bzip2 init failed\n");
-      return 0;
-    }
-
-    (void)BZ2_bzDecompressEnd(&strm);
-        
-    if (ret != BZ_STREAM_END) {
-      fprintf(stderr, "Bzip2 compression failed\n");
-      return 0;
-    }
-
-    return bmsg->raw_size;
+    fprintf(stderr, "Can't uncompress bz2 data\n");
+    return 0;
   } else if (bmsg->has_lzma_data) {
     fprintf(stderr, "Can't uncompress LZMA data\n");
     return 0;
@@ -243,6 +220,7 @@ int addInfoItems(struct keyval *head, Info *info, StringTable *string_table)
 	memcpy(username, user.data, user.len);
 
 	addItem(head, "osm_user", username, 0);
+    free(username);
       }
 
       /* TODO timestamp */
@@ -258,7 +236,7 @@ int processOsmHeader(void *data, size_t length)
     return 0;
   }
   
-  header_block__free_unpacked (hmsg, &protobuf_c_system_allocator);
+  header_block__free_unpacked (hmsg, NULL);
 
   return 1;
 }
@@ -346,6 +324,7 @@ int processOsmDataDenseNodes(struct osmdata_t *osmdata, PrimitiveGroup *group, S
                     valstr = calloc(string_table->s[deltauser_sid].len + 1, 1);
                     memcpy(valstr, string_table->s[deltauser_sid].data, string_table->s[deltauser_sid].len);
                     addItem(&(osmdata->tags), "osm_user", valstr,  0);
+                    free(valstr);
                 }
             }
             
@@ -541,7 +520,7 @@ int processOsmData(struct osmdata_t *osmdata, void *data, size_t length)
     if (!processOsmDataRelations(osmdata, group, string_table)) return 0;
   }
 
-  primitive_block__free_unpacked (pmsg, &protobuf_c_system_allocator);
+  primitive_block__free_unpacked (pmsg, NULL);
 
   return 1;
 }
@@ -606,8 +585,8 @@ int streamFilePbf(char *filename, int sanitize UNUSED, struct osmdata_t *osmdata
       }
     }
 
-    blob__free_unpacked (blob_msg, &protobuf_c_system_allocator);
-    block_header__free_unpacked (header_msg, &protobuf_c_system_allocator);
+    blob__free_unpacked (blob_msg, NULL);
+    block_header__free_unpacked (header_msg, NULL);
   } while (!feof(input));
 
   if (!feof(input)) {
diff --git a/parse-pbf.h b/parse-pbf.h
index f8f7013..8783bb0 100644
--- a/parse-pbf.h
+++ b/parse-pbf.h
@@ -23,7 +23,7 @@
 */
 
 #ifndef PARSE_PBF_H
-#define PARSE_PBF_h
+#define PARSE_PBF_H
 
 int streamFilePbf(char *filename, int sanitize, struct osmdata_t *osmdata);
 
diff --git a/parse-xml2.c b/parse-xml2.c
index 80fbe5c..ad31de8 100644
--- a/parse-xml2.c
+++ b/parse-xml2.c
@@ -100,13 +100,17 @@ static void StartElement(xmlTextReaderPtr reader, const xmlChar *name, struct os
         xid  = xmlTextReaderGetAttribute(reader, BAD_CAST "id");
         xlon = xmlTextReaderGetAttribute(reader, BAD_CAST "lon");
         xlat = xmlTextReaderGetAttribute(reader, BAD_CAST "lat");
-        assert(xid); assert(xlon); assert(xlat);
+        assert(xid);
 
         osmdata->osm_id   = strtoosmid((char *)xid, NULL, 10);
-        osmdata->node_lon = strtod((char *)xlon, NULL);
-        osmdata->node_lat = strtod((char *)xlat, NULL);
         osmdata->action   = ParseAction( reader , osmdata);
 
+        if (osmdata->action != ACTION_DELETE) {
+            assert(xlon); assert(xlat);
+            osmdata->node_lon = strtod((char *)xlon, NULL);
+            osmdata->node_lat = strtod((char *)xlat, NULL);
+        }
+
         if (osmdata->osm_id > osmdata->max_node)
             osmdata->max_node = osmdata->osm_id;
 
@@ -259,6 +263,12 @@ static void StartElement(xmlTextReaderPtr reader, const xmlChar *name, struct os
 	    addItem(&(osmdata->tags), "osm_timestamp", (char *)xtmp, 0);
             xmlFree(xtmp);
         }
+
+        xtmp = xmlTextReaderGetAttribute(reader, BAD_CAST "changeset");
+        if (xtmp) {
+	    addItem(&(osmdata->tags), "osm_changeset", (char *)xtmp, 0);
+            xmlFree(xtmp);
+        }
     }
 }
 
diff --git a/parse-xml2.h b/parse-xml2.h
index 2d32c93..3ddd423 100644
--- a/parse-xml2.h
+++ b/parse-xml2.h
@@ -23,7 +23,7 @@
 */
 
 #ifndef PARSE_XML2_H
-#define PARSE_XML2_h
+#define PARSE_XML2_H
 
 int streamFileXML2(char *filename, int sanitize, struct osmdata_t *osmdata);
 
diff --git a/pgsql.h b/pgsql.h
index f928f22..e21c292 100644
--- a/pgsql.h
+++ b/pgsql.h
@@ -3,7 +3,12 @@
 /* Current middle and output-pgsql do a lot of things similarly, this should
  * be used to abstract to commonalities */
 
+#ifndef PGSQL_H
+#define PGSQL_H
+
 PGresult *pgsql_execPrepared( PGconn *sql_conn, const char *stmtName, int nParams, const char *const * paramValues, ExecStatusType expect);
 int pgsql_CopyData(const char *context, PGconn *sql_conn, const char *sql);
 int pgsql_exec(PGconn *sql_conn, ExecStatusType expect, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
 void escape(char *out, int len, const char *in);
+
+#endif
diff --git a/style.lua b/style.lua
index 23616c1..c0a646e 100644
--- a/style.lua
+++ b/style.lua
@@ -12,14 +12,14 @@ generic_keys = {'access','addr:housename','addr:housenumber','addr:interpolation
 
 function add_z_order(keyvalues)
    z_order = 0
-   if (keyvalues["layer"] ~= nil ) then
+   if (keyvalues["layer"] ~= nil and tonumber(keyvalues["layer"])) then
       z_order = 10*keyvalues["layer"]
    end
 
    
    zordering_tags = {{ 'railway', nil, 5, 1}, { 'boundary', 'administrative', 0, 1}, 
       { 'bridge', 'yes', 10, 0 }, { 'bridge', 'true', 10, 0 }, { 'bridge', 1, 10, 0 },
-      { 'tunel', 'yes', -10, 0}, { 'tunel', 'true', -10, 0}, { 'tunel', 1, -10, 0}, 
+      { 'tunnel', 'yes', -10, 0}, { 'tunnel', 'true', -10, 0}, { 'tunnel', 1, -10, 0}, 
       { 'highway', 'minor', 3, 0}, { 'highway', 'road', 3, 0 }, { 'highway', 'unclassified', 3, 0 },
       { 'highway', 'residential', 3, 0 }, { 'highway', 'tertiary_link', 4, 0}, { 'highway', 'tertiary', 4, 0},
       { 'highway', 'secondary_link', 6, 1}, { 'highway', 'secondary', 6, 1},
diff --git a/tagtransform.c b/tagtransform.c
index 2814815..5263a2d 100644
--- a/tagtransform.c
+++ b/tagtransform.c
@@ -631,7 +631,7 @@ static unsigned int tagtransform_c_filter_rel_member_tags(
                     /* z_order and osm_ are automatically generated tags, so ignore them */
                     if ((strcmp(p->key, "z_order") != 0) && (strcmp(p->key, "osm_user") != 0) && 
                         (strcmp(p->key, "osm_version") != 0) && (strcmp(p->key, "osm_uid") != 0) &&
-                        (strcmp(p->key, "osm_changeset"))) {
+                        (strcmp(p->key, "osm_changeset")) && (strcmp(p->key, "osm_timestamp") != 0)) {
                         match = 0;
                         break;
                     }
diff --git a/tests/liechtenstein-2013-08-03.osm.bz2 b/tests/liechtenstein-2013-08-03.osm.bz2
new file mode 100644
index 0000000..4db9ac8
Binary files /dev/null and b/tests/liechtenstein-2013-08-03.osm.bz2 differ
diff --git a/tests/regression-test.py b/tests/regression-test.py
old mode 100644
new mode 100755
index ada11e3..e9c41e3
--- a/tests/regression-test.py
+++ b/tests/regression-test.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 import unittest
 import psycopg2
 import os
@@ -28,14 +30,14 @@ sql_test_statements=[
     ( 11, 'Absence of way table', 'SELECT count(*) FROM pg_tables WHERE tablename = \'planet_osm_ways\'', 0),
     ( 12, 'Absence of rel line', 'SELECT count(*) FROM pg_tables WHERE tablename = \'planet_osm_rels\'', 0),
     ( 13, 'Basic polygon area', 'SELECT round(sum(cast(ST_Area(way) as numeric)),0) FROM planet_osm_polygon;', 1223800814),
-    ( 14, 'Gazetteer place count', 'SELECT count(*) FROM place', 4500),
-    ( 15, 'Gazetteer place node count', 'SELECT count(*) FROM place WHERE osm_type = \'N\'', 779),
-    ( 16, 'Gazetteer place way count', 'SELECT count(*) FROM place WHERE osm_type = \'W\'', 3699),
-    ( 17, 'Gazetteer place rel count', 'SELECT count(*) FROM place WHERE osm_type = \'R\'', 22),
-    ( 18, 'Gazetteer post-diff place count', 'SELECT count(*) FROM place', 4554),
-    ( 19, 'Gazetteer post-diff place node count', 'SELECT count(*) FROM place WHERE osm_type = \'N\'', 788),
-    ( 20, 'Gazetteer post-diff place way count', 'SELECT count(*) FROM place WHERE osm_type = \'W\'', 3744),
-    ( 21, 'Gazetteer post-diff place rel count', 'SELECT count(*) FROM place WHERE osm_type = \'R\'', 22),
+    ( 14, 'Gazetteer place count', 'SELECT count(*) FROM place', 4374),
+    ( 15, 'Gazetteer place node count', 'SELECT count(*) FROM place WHERE osm_type = \'N\'', 778),
+    ( 16, 'Gazetteer place way count', 'SELECT count(*) FROM place WHERE osm_type = \'W\'', 3577),
+    ( 17, 'Gazetteer place rel count', 'SELECT count(*) FROM place WHERE osm_type = \'R\'', 19),
+    ( 18, 'Gazetteer post-diff place count', 'SELECT count(*) FROM place', 4428),
+    ( 19, 'Gazetteer post-diff place node count', 'SELECT count(*) FROM place WHERE osm_type = \'N\'', 787),
+    ( 20, 'Gazetteer post-diff place way count', 'SELECT count(*) FROM place WHERE osm_type = \'W\'', 3622),
+    ( 21, 'Gazetteer post-diff place rel count', 'SELECT count(*) FROM place WHERE osm_type = \'R\'', 19),
     ( 22, 'Gazetteer housenumber count', 'SELECT count(*) FROM place WHERE housenumber is not null', 199),
     ( 23, 'Gazetteer post-diff housenumber count count', 'SELECT count(*) FROM place WHERE housenumber is not null', 199),
     ( 24, 'Gazetteer isin count', 'SELECT count(*) FROM place WHERE isin is not null', 239),
@@ -226,6 +228,7 @@ class NonSlimRenderingTestSuite(unittest.TestSuite):
                                               "testTwo")))
         self.addTest(BasicNonSlimTestCase("basic case",[], [0,1,2,3,10,13, 91, 92]))
         self.addTest(BasicNonSlimTestCase("slim --drop case",["--slim","--drop"], [0,1,2,3, 10, 11, 12, 13, 91, 92]))
+        self.addTest(BasicNonSlimTestCase("Hstore index drop", ["--slim", "--hstore", "--hstore-add-index", "--drop"], [51,52,53,54]))
         self.addTest(BasicNonSlimTestCase("lat lon projection",["-l"], [0,4,5,3,10, 11, 12]))
         #Failing test 3,13 due to difference in handling mixture of tags on ways and relations, where the correct behaviour is non obvious
         #self.addTest(BasicNonSlimTestCase("--tag-transform-script", ["--tag-transform-script", "style.lua"], [0,1,2,3,10,13,91,92]))
@@ -248,6 +251,7 @@ class SlimRenderingTestSuite(unittest.TestSuite):
         self.addTest(BasicSlimTestCase("Hstore name column", ["-z", "name:"], [0,1,2,3],[6,7,8,9]))
         self.addTest(BasicSlimTestCase("Hstore", ["-k"], [51,52,53,54],[55,56,57,58]))
         self.addTest(BasicSlimTestCase("Hstore all", ["-j"], [51,52,53,54,93,94,95,96],[55,56,57,58, 97, 98, 99, 100]))
+        self.addTest(BasicSlimTestCase("Hstore index", ["--hstore", "--hstore-add-index"], [51,52,53,54],[55,56,57,58]))        
         #tests dont check for osm_timestamp which is currently missing in the pbf parser
         self.addTest(BasicSlimTestCase("Extra tags hstore match only", ["-x", "-k", "--hstore-match-only"], [0,1,2,3],[6,7,8,9]))
         self.addTest(BasicSlimTestCase("Extra tags hstore all", ["-j", "-x"], [51,52,53,54,59,60,61],[55,56,57,58]))
@@ -367,28 +371,34 @@ class BaseTestCase(unittest.TestCase):
 class BaseNonSlimTestCase(BaseTestCase):
     
     def setUpGeneric(self, parameters, file):
-        returncode = subprocess.call(["./osm2pgsql", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [full_import_file])
-        self.assertEqual( returncode, 0, "Execution of osm2pgsql with options: " + str(parameters) + " failed")
+        proc = subprocess.Popen(["./osm2pgsql", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [full_import_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (outp, outerr) = proc.communicate()
+        self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
 
 class BaseSlimTestCase(BaseTestCase):    
         
     def setUpGeneric(self, parameters, file):
-        returncode = subprocess.call(["./osm2pgsql", "--slim", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file])
-        self.assertEqual( returncode, 0, "Execution of osm2pgsql --slim with options: " + str(parameters) + " failed")
+        proc = subprocess.Popen(["./osm2pgsql", "--slim", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (outp, outerr) = proc.communicate()
+        self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
 
     def updateGeneric(self, parameters, file):
-        returncode = subprocess.call(["./osm2pgsql", "--slim", "--append", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file])
-        self.assertEqual( returncode, 0, "Execution of osm2pgsql --slim --append with options: " + str(parameters) + " failed")
-
+        proc = subprocess.Popen(["./osm2pgsql", "--slim", "--append", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (outp, outerr) = proc.communicate()
+        self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append with options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
+        
 class BaseGazetteerTestCase(BaseTestCase):    
         
     def setUpGeneric(self, parameters, file):
-        returncode = subprocess.call(["./osm2pgsql", "--slim", "-Ogazetteer", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file])
-        self.assertEqual( returncode, 0, "Execution of osm2pgsql --slim -Ogazetteer with options: " + str(parameters) + " failed")
+        proc = subprocess.Popen(["./osm2pgsql", "--slim", "-Ogazetteer", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (outp, outerr) = proc.communicate()
+        self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim gazetteer options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
 
     def updateGeneric(self, parameters, file):
-        returncode = subprocess.call(["./osm2pgsql", "--slim", "-Ogazetteer", "--append", "-Sdefault.style", "-dosm2pgsql-test", "-C100"] + parameters + [file])
-        self.assertEqual( returncode, 0, "Execution of osm2pgsql --slim -Ogazetteer --append with options: " + str(parameters) + " failed")
+        proc = subprocess.Popen(["./osm2pgsql", "--slim", "-Ogazetteer", "--append", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (outp, outerr) = proc.communicate()
+        self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append gazetteer options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
+        
 
 #****************************************************************
 class BasicNonSlimTestCase(BaseNonSlimTestCase):
@@ -524,7 +534,7 @@ def setupDB():
                 print "We already have a tablespace, can use that"
                 created_tablespace = 0
             else:
-                print "For the test, we need to create a tablespace. This needs root privilidges"
+                print "For the test, we need to create a tablespace. This needs root privileges"
                 created_tablespace = 1
                 ### This makes postgresql read from /tmp
                 ## Does this have security implications like opening this to a possible symlink attack?
@@ -595,6 +605,19 @@ def tearDownDB():
         returncode = subprocess.call(["/usr/bin/sudo", "/bin/rmdir", "/tmp/psql-tablespace"])
 
 
+if __name__ == "__main__":
+
+    from optparse import OptionParser
+
+    parser = OptionParser()
+    parser.add_option("-f", dest="osm_file", action="store", metavar="FILE",
+                      default=full_import_file,
+                      help="Import a specific osm file [default=%default]")
+    (options, args) = parser.parse_args()
+
+    if options.osm_file:
+        full_import_file = options.osm_file
+
 
 ts2 = CompleteTestSuite()
 try:
diff --git a/tests/regression-test.sh b/tests/regression-test.sh
deleted file mode 100755
index f1ae77d..0000000
--- a/tests/regression-test.sh
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/bin/bash
-set -e
-
-trap errorhandler ERR
-
-errorhandler(){
-    echo "!!!!!!TEST failed, please check results!!!!!!"
-    exit $status
-}
-
-planetfile=$1
-planetdiff=$2
-test_output=`dirname  $0`/test_output_$$
-
-function setup_db {
-    echo ""
-    echo "Initialising test db"
-    dropdb osm2pgsql-test > /dev/null || true
-    createdb -E UTF8 osm2pgsql-test
-    if [ -d "/usr/share/postgresql/9.1/contrib/postgis-1.5/" ]; then
-        postgis_dir=/usr/share/postgresql/9.1/contrib/postgis-1.5
-    fi
-    if [ -z $postgis_dir ]; then
-        psql -c "CREATE EXTENSION postgis;" -d osm2pgsql-test &> /dev/null
-    else
-        psql -f $postgis_dir/postgis.sql -d osm2pgsql-test > /dev/null
-        psql -f $postgis_dir/spatial_ref_sys.sql -d osm2pgsql-test > /dev/null
-    fi
-    psql -c "CREATE EXTENSION hstore;" -d osm2pgsql-test &> /dev/null
-    sudo rm -rf /tmp/psql-tablespace || true
-    mkdir /tmp/psql-tablespace
-    sudo chown postgres.postgres /tmp/psql-tablespace
-    psql -q -c "DROP TABLESPACE tablespacetest" -d osm2pgsql-test > /dev/null || true
-    psql -c "CREATE TABLESPACE tablespacetest LOCATION '/tmp/psql-tablespace'" -d osm2pgsql-test
-}
-
-function teardown_db {
-    echo "Cleaning up"
-    dropdb osm2pgsql-test #To remove any objects that might still be in the table space
-    psql -c "DROP TABLESPACE tablespacetest" -d postgres
-    sudo rm -rf /tmp/psql-tablespace
-    rm -f $test_output $test_output.*
-}
-
-function psql_test {
-    ( echo -n "$1"; psql -c "$2" -t -d osm2pgsql-test ) | tee -a $test_output.tmp
-}
-
-function reset_results {
-    rm -f $test_output $test_output.*
-}
-
-function compare_results {
-    if [ ! -r $test_output ]; then
-        mv $test_output.tmp $test_output
-    elif diff $test_output $test_output.tmp >/dev/null; then
-        rm $test_output.tmp
-    else
-        errorhandler
-    fi
-}
-
-function test_osm2pgsql_slim {
-    trap errorhandler ERR
-    echo ""
-    echo ""
-    echo "@@@Testing osm2pgsql in slim mode with the following parameters: \"" $1 "\"@@@"
-    setup_db
-
-    dbprefix=${2:-planet_osm}
-
-    ./osm2pgsql --slim --create -d osm2pgsql-test $1 $planetfile
-    psql_test "Number of points imported" "SELECT count(*) FROM ${dbprefix}_point;"
-    psql_test "Number of lines imported" "SELECT count(*) FROM ${dbprefix}_line;"
-    psql_test "Number of roads imported" "SELECT count(*) FROM ${dbprefix}_roads;"
-    psql_test "Number of polygon imported" "SELECT count(*) FROM ${dbprefix}_polygon;"
-    psql_test "Number of nodes imported" "SELECT count(*) FROM ${dbprefix}_nodes;"
-    psql_test "Number of ways imported" "SELECT count(*) FROM ${dbprefix}_ways;"
-    psql_test "Number of relations imported" "SELECT count(*) FROM ${dbprefix}_rels;"
-    psql_test "Length of lines imported" "SELECT sum(ST_length(way)) FROM ${dbprefix}_line;"
-    psql_test "Length of roads imported" "SELECT sum(ST_length(way)) FROM ${dbprefix}_roads;"
-    psql_test "Area of polygons imported" "SELECT sum(ST_area(way)) FROM ${dbprefix}_polygon;"
-
-
-    echo "***Testing osm2pgsql diff import with the following parameters: \"" $1 "\"***"
-    ./osm2pgsql --slim --append -d osm2pgsql-test $1 $planetdiff
-    psql_test "Number of points imported" "SELECT count(*) FROM ${dbprefix}_point;"
-    psql_test "Number of lines imported" "SELECT count(*) FROM ${dbprefix}_line;"
-    psql_test "Number of roads imported" "SELECT count(*) FROM ${dbprefix}_roads;"
-    psql_test "Number of polygon imported" "SELECT count(*) FROM ${dbprefix}_polygon;"
-    psql_test "Number of nodes imported" "SELECT count(*) FROM ${dbprefix}_nodes;"
-    psql_test "Number of ways imported" "SELECT count(*) FROM ${dbprefix}_ways;"
-    psql_test "Number of relations imported" "SELECT count(*) FROM ${dbprefix}_rels;"
-    psql_test "Length of lines imported" "SELECT sum(ST_length(way)) FROM ${dbprefix}_line;"
-    psql_test "Length of roads imported" "SELECT sum(ST_length(way)) FROM ${dbprefix}_roads;"
-    psql_test "Area of polygons imported" "SELECT sum(ST_area(way)) FROM ${dbprefix}_polygon;"
-
-    compare_results
-}
-
-function test_osm2pgsql_gazetteer {
-    trap errorhandler ERR
-    echo ""
-    echo ""
-    echo "@@@Testing osm2pgsql in gazetteer mode with the following parameters: \"" $1 "\"@@@"
-    setup_db
-
-    dbprefix=${2:-planet_osm}
-
-    ./osm2pgsql --slim --create -l -O gazetteer -d osm2pgsql-test $1 $planetfile
-    psql_test "Number of places imported" "SELECT count(*) FROM place;"
-    psql_test "Number of nodes imported" "SELECT count(*) FROM ${dbprefix}_nodes;"
-    psql_test "Number of ways imported" "SELECT count(*) FROM ${dbprefix}_ways;"
-    psql_test "Number of relations imported" "SELECT count(*) FROM ${dbprefix}_rels;"
-
-    echo "***Testing osm2pgsql diff import with the following parameters: \"" $1 "\"***"
-    ./osm2pgsql --slim --append -l -O gazetteer -d osm2pgsql-test $1 $planetdiff
-    psql_test "Number of places imported" "SELECT count(*) FROM place;"
-    psql_test "Number of nodes imported" "SELECT count(*) FROM ${dbprefix}_nodes;"
-    psql_test "Number of ways imported" "SELECT count(*) FROM ${dbprefix}_ways;"
-    psql_test "Number of relations imported" "SELECT count(*) FROM ${dbprefix}_rels;"
-    compare_results
-}
-
-function test_osm2pgsql_nonslim {
-    trap errorhandler ERR
-    echo ""
-    echo ""
-    echo "@@@Testing osm2pgsql with the following parameters: \"" $1 "\"@@@"
-    setup_db
-    ./osm2pgsql --create -d osm2pgsql-test $1 $planetfile
-    psql_test "Number of points imported" "SELECT count(*) FROM planet_osm_point;"
-    psql_test "Number of lines imported" "SELECT count(*) FROM planet_osm_line;"
-    psql_test "Number of roads imported" "SELECT count(*) FROM planet_osm_roads;"
-    psql_test "Number of polygon imported" "SELECT count(*) FROM planet_osm_polygon;"
-    psql_test "Length of lines imported" "SELECT sum(ST_length(way)) FROM planet_osm_line;"
-    psql_test "Length of roads imported" "SELECT sum(ST_length(way)) FROM planet_osm_roads;"
-    psql_test "Area of polygons imported" "SELECT sum(ST_area(way)) FROM planet_osm_polygon;"
-
-    
-    compare_results
-}
-
-
-test_osm2pgsql_nonslim "-S default.style -C 100"
-test_osm2pgsql_nonslim "--slim --drop -S default.style -C 100"
-reset_results #results depend on projection, so we have to reset them
-test_osm2pgsql_nonslim "-S default.style -l -C 100"
-reset_results
-
-echo ========== NOW DOING SLIM =============
-test_osm2pgsql_slim "-S default.style -C 100"
-test_osm2pgsql_slim "-p planet_osm2 -S default.style -C 100" "planet_osm2"
-test_osm2pgsql_slim "--number-processes 6 -S default.style -C 100"
-test_osm2pgsql_slim "-I -S default.style -C 100"
-test_osm2pgsql_slim "-e 16:16 -S default.style -C 100"
-test_osm2pgsql_slim "--number-processes 6 -e 16:16 -S default.style -C 100"
-test_osm2pgsql_slim "-S default.style -C 100 -i tablespacetest"
-test_osm2pgsql_slim "-S default.style -C 100 --tablespace-main-data tablespacetest"
-test_osm2pgsql_slim "-S default.style -C 100 --tablespace-main-index tablespacetest"
-test_osm2pgsql_slim "-S default.style -C 100 --tablespace-slim-data tablespacetest"
-test_osm2pgsql_slim "-S default.style -C 100 --tablespace-slim-index tablespacetest"
-reset_results
-test_osm2pgsql_slim "-S default.style -C 100 --tag-transform-script style.lua"
-test_osm2pgsql_slim "-S default.style -C 100 --number-processes 6 --tag-transform-script style.lua"
-reset_results #Using multi-geometry effects the number of elements in the database
-test_osm2pgsql_slim "-G -S default.style -C 100"
-reset_results #Using hsotre effects the number of elements in the database
-test_osm2pgsql_slim "-k -S default.style -C 100"
-reset_results #Using hsotre effects the number of elements in the database
-test_osm2pgsql_slim "-j -S default.style -C 100"
-test_osm2pgsql_slim "-j --number-processes 6 -S default.style -C 100"
-test_osm2pgsql_slim "-j --hstore-add-index -S default.style -C 100"
-reset_results
-test_osm2pgsql_slim "-K -S default.style -C 100"
-reset_results
-test_osm2pgsql_slim "-x -S default.style -C 100"
-reset_results
-test_osm2pgsql_slim "--bbox -90.0,-180.0,90.0,180.0 -S default.style -C 100"
-reset_results
-test_osm2pgsql_slim "-S default.style -l -C 100"
-reset_results
-
-echo ========== NOW DOING GAZETTEER =============
-test_osm2pgsql_gazetteer "-C 100"
-reset_results
-test_osm2pgsql_gazetteer "--bbox -90.0,-180.0,90.0,180.0 -C 100"
-
-teardown_db
-
-
-
diff --git a/wildcmp.h b/wildcmp.h
index 28cba0a..0321f15 100644
--- a/wildcmp.h
+++ b/wildcmp.h
@@ -1,5 +1,10 @@
+#ifndef WILDCMP_H
+#define WILDCMP_H
+
 #define NO_MATCH 0
 #define FULL_MATCH 1
 #define WC_MATCH 2
 
 int wildMatch(char *wildCard, char *string);
+
+#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm2pgsql.git



More information about the Pkg-grass-devel mailing list