2

I've been trying to rasterize big PBF (1.2GB) file using gdal_rasterize and got this error:

ERROR 1: Too many features have accumulated in lines layer. Use the OGR_INTERLEAVED_READING=YES configuration option, or the INTERLEAVED_READING=YES open option, or the GDALDataset::GetNextFeature() / GDALDatasetGetNextFeature() API. 

so I added --config OGR_INTERLEAVED_READING YES to gdal_rasterize command and the error dissapeared, but in result I've got empty file, that is gdalinfo -stats reports

ERROR 1: test2.tif, band 1: Failed to compute statistics, no valid pixels found in sampling. NoData Value=200 Metadata: STATISTICS_VALID_PERCENT=0 

As a walkaround I converted the PBF to GPKG file, but I'm wondering if there is a way to use gdal_rasterize with large PBFs without converting.

I use GDAL 3.5.0 on Linux (Centos7).

1 Answer 1

0

The error happens when GDAL/OGR is reading the PBF data. There is some information about when using interleaved reading is needed at https://gdal.org/drivers/vector/osm.html#interleaved-reading.

The error message is raised by the OSM driver after line https://github.com/OSGeo/gdal/blob/master/ogr/ogrsf_frmts/osm/ogrosmlayer.cpp#L324

and it is triggered when m_nFeatureArraySize > MAX_THRESHOLD. The MAX_THRESHOLD is set into 100000 in the code at line https://github.com/OSGeo/gdal/blob/master/ogr/ogrsf_frmts/osm/ogrosmlayer.cpp#L62.

I do not know why gdal_rasterize creates an empty image with --config OGR_INTERLEAVED_READING YES. I guess that it should work but but maybe the gdal_rasterize application has not been updated to implement this:

Starting with GDAL 2.2, applications should use the GDALDataset::GetNextFeature() API to iterate over features in the order they are produced.

If you wish you can write mail to gdal-dev mailing list and ask if you have found a bug and if confirmed, create a bug report at https://github.com/OSGeo/gdal/issues/new.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.