Skip to content

Commit

Permalink
gdal: only register drivers once
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmare committed Mar 2, 2016
1 parent ff7d04f commit d4566c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/input/gdal/gdal_datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ using mapnik::layer_descriptor;
using mapnik::datasource_exception;


static bool GDALAllRegister_once_()
{
static bool const quiet_unused = (GDALAllRegister(), true);
return quiet_unused;
}

gdal_datasource::gdal_datasource(parameters const& params)
: datasource(params),
dataset_(nullptr),
Expand All @@ -54,12 +60,12 @@ gdal_datasource::gdal_datasource(parameters const& params)
{
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";

GDALAllRegister_once_();

#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init");
#endif

GDALAllRegister();

boost::optional<std::string> file = params.get<std::string>("file");
if (! file) throw datasource_exception("missing <file> parameter");

Expand Down

0 comments on commit d4566c2

Please sign in to comment.