formatting

This commit is contained in:
Joel Brown 2014-08-12 11:54:46 -06:00
parent e9d1ea8032
commit 106ecb2b9c
2 changed files with 18 additions and 7 deletions

View file

@ -254,17 +254,28 @@ void ogr_datasource::init(mapnik::parameters const& params)
OGRLayer* layer = layer_.layer();
// initialize envelope
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext && !ext->empty())
{
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

View file

@ -54,7 +54,7 @@ if 'ogr' in mapnik.DatasourceCache.plugin_names():
query.add_property_name('bogus')
fs = ds.features(query)
# OGR plugin extent parameter
# OGR plugin extent parameter
def test_ogr_extent_parameter():
ds = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0,extent='-1,-1,1,1')
e = ds.envelope()