formatting
This commit is contained in:
parent
e9d1ea8032
commit
106ecb2b9c
2 changed files with 18 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue