[gdal-dev] Efficiency question for using the OGR API
Frank Warmerdam
warmerdam at pobox.com
Tue Oct 12 10:57:35 EDT 2010
Peter J Halls wrote:
> Dear All,
>
> when needing to have multiple output channels open through OGR to the
> same location, is it generally more efficient to open a new datasource /
> OGR instance for each channel / output layer, or to open one datasource
> / Ogr instance and maintain a list of layer handles for each of the
> separate layers accessed through this datasource / OGR instance?
>
> Are there any realistic limits to the number of 'open' layers per
> datasource?
Peter,
I would say that there is no significant difference at the OGR API level
to having many datasources with one layer each vs. one datasource with many
layers.
However, within particular drivers there can be dramatic differences.
For instance, many of the RDBMS drivers are somewhat fragile in the face
of mixing operations on different layer and will at least have to close
off transactions and start new ones each time you switch layers to
write (for instance). So, for RDBMSes I'd suggest one connection for
each layer you want to concurrently write and perhaps one more for
read operations.
Some datasources are pretty expensive and it the cost of keeping multiple
copies open would be high. For instance the S-57 driver aggressively
caches stuff in memory and it could be a disaster to have many
datasources open on the same underlying file.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list