From 9de066e0359e3dc41e4eec81cb4f4255f149a11f Mon Sep 17 00:00:00 2001 From: Lucio Asnaghi Date: Fri, 8 May 2009 21:15:05 +0000 Subject: [PATCH] + make use of GDALOpenShared instead of GDALOpen, which could be better performing when using multiple equal datasource reads (no need to open multiple datasources, and yes it is still thread safe) --- plugins/input/gdal/gdal_datasource.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index f89dc9cff..ae4e44a5a 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -37,7 +37,7 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::datasource_exception; -gdal_datasource::gdal_datasource( parameters const& params) +gdal_datasource::gdal_datasource(parameters const& params) : datasource(params), extent_(), desc_(*params.get("type"),"utf-8") @@ -52,8 +52,9 @@ gdal_datasource::gdal_datasource( parameters const& params) else dataset_name_ = *file; - dataset_ = boost::shared_ptr(reinterpret_cast(GDALOpen((dataset_name_).c_str(),GA_ReadOnly))); + dataset_ = boost::shared_ptr(reinterpret_cast(GDALOpenShared((dataset_name_).c_str(),GA_ReadOnly))); if (!dataset_) throw datasource_exception(CPLGetLastErrorMsg()); + double tr[6]; dataset_->GetGeoTransform(tr); double x0 = tr[0];