[gdal-dev] How to set OGR_INTERLEAVED_READING when using the OSM driver

Even Rouault even.rouault at mines-paris.org
Sat Mar 16 15:51:12 PDT 2013

Le samedi 16 mars 2013 20:51:42, Paolo Corti a écrit :
> Hi Even and Jukka, please follow me inline:
> On Fri, Mar 15, 2013 at 10:47 PM, Even Rouault
> <even.rouault at mines-paris.org> wrote:
> >> According to the documentation anyway, the option should not be set at
> >> all, as "the ogr2ogr application has been modified to use that
> >> OGR_INTERLEAVED_READING mode without any particular user action".
> >> 
> >> Ideas? Am I doing something obviously wrong?
> > 
> > Indeed, there's nothing special to do. The "ogr2ogr test.shp myfile.pbf
> > lines" line is sufficient and I've just tested it successfully.
> > 
> > My hypothesis, from the above debug log, would be that you don't run the
> > ogr2ogr binary from trunk, but perhaps the one from a previous release...
> You are right, I had a previous GDAL version on the computer I am
> working (I think 1.9.2), but after building from trunk the GDAL
> commands seem to have been correctly updated:
> $ ogr2ogr --version
> GDAL 1.10dev, released 2011/12/29
> > Configuration options are given as --config OPTION VALUE
> > 
> > This is the command I have been using for converting OSM data into
> > Spatialite
> > 
> > ogr2ogr finland.sqlite finland.osm.pbf -f SQLite -dsco SPATIALITE=YES
> > -gt 10000 --config OGR_SQLITE_SYNCHRONOUS OFF
> Thanks for the information, but it is not working for me.
> I am trying to load to a PostGIS layer using the following syntax. It
> seems that first time the table is only created, without uploading
> features to it.
> Using ogr2ogr with the -append option after it, I will be able to
> manage to upload features to it, but only 10k at a time, as the
> OGR_INTERLEAVED_READING configuration seems to be ignored when
> appending:
> The first time I run ogr2ogr, PostGIS layer is correctly created, but
> features not uploaded:
> $ ogr2ogr -f PostgreSQL -lco GEOMETRY_NAME=the_geom -nln
> myschema.osm_roads PG:"dbname='mydb' user='me' password='mypassword'"
> myosm.pbf lines --config OGR_INTERLEAVED_READING YES --debug ON

Hum, actually looking at ogr2ogr.cpp, I see that if you specified  --config 
OGR_INTERLEAVED_READING YES , it would not use the special routine to do 
interleaved reading... It was working if you didn't specify anything (YES was 
assumed to be the default value). I've just fixed that so that specifying --
config OGR_INTERLEAVED_READING YES also works ...

More information about the gdal-dev mailing list