Merge pull request #2354 from kernelsanders/master

add ogr plugin error handling to master/3.x
This commit is contained in:
Dane Springmeyer 2014-08-12 23:20:27 -07:00
commit 522417835b

View file

@ -261,7 +261,13 @@ void ogr_datasource::init(mapnik::parameters const& params)
else
{
OGREnvelope envelope;
layer->GetExtent(&envelope);
OGRErr e = layer->GetExtent(&envelope);
if (e == OGRERR_FAILURE)
{
std::ostringstream s;
s << "OGR Plugin: Extent missing for layer '" << layer->GetName() << "'. Use <extent> paramater to define a custom extent value.";
throw datasource_exception(s.str());
}
extent_.init(envelope.MinX, envelope.MinY, envelope.MaxX, envelope.MaxY);
}