[OSM-dev] osm2pgsql: missing osm_polygon and osm_line data under PostgreSQL 9/PostGIS 1.5.2

Jon Burgess jburgess777 at gmail.com
Fri May 6 19:53:44 BST 2011

On Fri, 2011-05-06 at 20:23 +0200, Stefan Keller wrote:
> Hi,
> We recently upgraded to PostgreSQL 9 and PostGIS 1.5.2 and hence were
> forced to rebuild osm2pgsql because of new versions of its
> dependencies (e.g., libgeos).
> Afterwards, we tried to insert Switzerland data with the following command:
> $ osm2pgsql --create --database gisdb --prefix osm --style
> /usr/local/share/osm2pgsql/default.style --username xxx --hstore-all
> switzerland.osm.bz2
> Unfortunately, only the osm_point table was filled with data,
> osm_polygon and osm_line were empty. This was not the case before the
> upgrade of the mentioned components. In the thread
> http://forum.openstreetmap.org/viewtopic.php?id=10725 somebody
> explained that this could be caused by multiple installations of
> libgeos or due to old installations of this library which is silently
> ignored by osm2pgsql and hence the tables will just not be filled.
> On our machine, I verified that this is NOT the case:
> $ ldd /usr/local/bin/osm2pgsql  | grep libgeos
>     libgeos-3.2.2.so => /usr/lib/libgeos-3.2.2.so (0x00007f8485065000)
> As one can see, there is only one version of the shared library that
> is used and that one has the version we need.
> Do you have any ideas what the problem could be?

I encountered the same problem when doing a similar upgrade yesterday. I
managed to resolve it but I have not gone back to figure out exactly
what causes it. 

The machine originally had both the system geos library in /usr and a
custom compiled one in /usr/local. To resolve the problem I made sure I
erased all traces of the system geos library and header files. Then did
a 'make clean && make' cycle and it started working correctly.

I did a few steps to try to figure out where it was going wrong and
identified that the getSize() call in build_geometry.cpp is always
returning 0. This causes all of the line & polygons geometries to be
discarded. I have a suspicion this is triggered when using the headers
from one version of geos and then linking against a different library
version but I can not prove this yet.


More information about the dev mailing list