Add optional extent paramater to ogr plugin

This commit is contained in:
Joel Brown 2014-08-11 16:06:21 -06:00
parent fdf86c7411
commit d75fb237b1
2 changed files with 11 additions and 3 deletions

0
demo/python/rundemo.py Normal file → Executable file
View file

View file

@ -254,9 +254,17 @@ void ogr_datasource::init(mapnik::parameters const& params)
OGRLayer* layer = layer_.layer();
// initialize envelope
OGREnvelope envelope;
layer->GetExtent(&envelope);
extent_.init(envelope.MinX, envelope.MinY, envelope.MaxX, envelope.MaxY);
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext && !ext->empty())
{
extent_.from_string(*ext);
}
else
{
OGREnvelope envelope;
layer->GetExtent(&envelope);
extent_.init(envelope.MinX, envelope.MinY, envelope.MaxX, envelope.MaxY);
}
// scan for index file
// TODO - layer names don't match dataset name, so this will break for