[gdal-dev] [EXTERNAL] Re: ogr2ogr does not convert OSM polygons

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Nov 2 09:29:30 PDT 2021


Hi,

I made a couple of quick tests with algeria-latest

ogrinfo algeria-latest.osm.pbf
INFO: Open of `algeria-latest.osm.pbf'
      using driver `OSM' successful.
1: points (Point)
2: lines (Line String)
3: multilinestrings (Multi Line String)
4: multipolygons (Multi Polygon)
5: other_relations (Geometry Collection)

ogr2ogr -f GPKG algeria.gpkg algeria-latest.osm.pbf
0...10...20...30...40...50...60...70...80...90...100 - done.

ogrinfo algeria.gpkg multipolygons -so
INFO: Open of `algeria.gpkg'
      using driver `GPKG' successful.

Layer name: multipolygons
Geometry: Multi Polygon
Feature Count: 725379

There are multipolygons in the data and ogr2ogr can convert them into "multipolygons" when the target is GeoPackage. Repeat the test. If you get the same result the issue must have a connection to PostGIS. If you get a different result then there is something else.  By GDAL is from gisinternals.com, version 3.4.0dev.

-Jukka Rahkonen-

Lähettäjä: Clay, Bruce <bclay at infoscitex.com>
Lähetetty: tiistai 2. marraskuuta 2021 18.19
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>
Aihe: Re: [EXTERNAL] Re: ogr2ogr does not convert OSM polygons

Jukka:
  Thanks for your reply.

I was in the progress of loading all OSM so I started with Africa and saw the same thing for all pbf files.  You can pick a small one such as algeria-latest.osm.pbf.  In my post I  just replaced the country name with the word "country" to be generic.  All of the files came from the website you mentioned.

I am using the OSGeo shell on Windows 10.  gdalinfo show version is 3.0.4
I did not change the osmconf.ini file.

After looking deeper into the table osm2pgsql created I noticed roads are not actually put in the osm roads layer.  administrative boundaries or other lines were in there. More lines are in the table created by osm2pgsql than the table created by ogr2ogr.

it looks like ogr2ogr would produce a similar approach if it would generate the polygon table.

Bruce


________________________________
From: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Sent: Tuesday, November 2, 2021 11:11 AM
To: Clay, Bruce <bclay at infoscitex.com<mailto:bclay at infoscitex.com>>; gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org> <gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>>
Subject: [EXTERNAL] Re: ogr2ogr does not convert OSM polygons


Hi,



What layers does "ogrinfo country_pbf" list? Can you reproduce the error with some small OSM country file from http://download.geofabrik.de/<https://usg02.safelinks.protection.office365.us/?url=http%3A%2F%2Fdownload.geofabrik.de%2F&data=04%7C01%7Cbclay%40infoscitex.com%7Cd3072cf4fd6944d85eba08d99e131143%7C3430c5de5e6f4f9d9d9690e985038b58%7C0%7C0%7C637714627010157244%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=W1Mn6rR62o9fuXMpTnvNafi5zTgtUG89%2F5XQMJNw2R0%3D&reserved=0>?

What is your operating system and GDAL version? Do you use the default osmconf.ini file? GDAL OSM driver and osm2pgsql are creating quite different database schemas so they are not very comparable.



-Jukka Rahkonen-



Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> Puolesta Clay, Bruce
Lähetetty: tiistai 2. marraskuuta 2021 16.22
Vastaanottaja: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] ogr2ogr does not convert OSM polygons



When I convert a OSM pbf file to postgres using the following script it does not create a multipolygon table



ogr2ogr -f PostgreSQL PG:"dbname='open_street_map' host='db-host' port='5432' user='postgres' password='pwd'" -lco schema=country country_pbf  --config OSM_MAX_TMPFILE_SIZE 1024



When I do the same thing using osm2pgsql (shown below) it creates the polygon table but not the other_relations table



osm2pgsql -H hostname -U postgres -d open_street_map --output-pgsql-schema=country --create --latlong -G --hstore --tag-transform-script /OpenStreetMap/openstreetmap-carto-master/openstreetmap-carto.lua -C 2500 --number-processes 5 -S /OpenStreetMap/openstreetmap-carto-master/openstreetmap-carto.style country-latest.osm.pbf.



I did not see this problem when I Googled.



Is this a known issue and is there a work around?



Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211102/3a4efbcb/attachment.html>


More information about the gdal-dev mailing list