+ consistent raster bbox calc :
x0 = int(minx+0.5) y0 = int(miny+0.5) x1 = int(maxx+0.5) y1 = int(maxy+0.5) width = x1 - x0 height = y1 - y0
This commit is contained in:
parent
05f5473924
commit
22d8fbe7f0
1 changed files with 15 additions and 4 deletions
|
@ -73,10 +73,21 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
||||||
CoordTransform t(image_width,image_height,extent_,0,0);
|
CoordTransform t(image_width,image_height,extent_,0,0);
|
||||||
box2d<double> intersect=bbox_.intersect(curIter_->envelope());
|
box2d<double> intersect=bbox_.intersect(curIter_->envelope());
|
||||||
box2d<double> ext=t.forward(intersect);
|
box2d<double> ext=t.forward(intersect);
|
||||||
image_data_32 image(int(ext.width()+0.5),int(ext.height()+0.5));
|
|
||||||
reader->read(int(ext.minx()+0.5),int(ext.miny()+0.5),image);
|
int start_x = int(ext.minx() + 0.5);
|
||||||
feature->set_raster(mapnik::raster_ptr(new raster(intersect,image)));
|
int start_y = int(ext.miny() + 0.5);
|
||||||
}
|
int end_x = int(ext.maxx() + 0.5);
|
||||||
|
int end_y = int(ext.maxy() + 0.5);
|
||||||
|
|
||||||
|
unsigned w = end_x - start_x;
|
||||||
|
unsigned h = end_y - start_y;
|
||||||
|
if ( w > 0 && h > 0)
|
||||||
|
{
|
||||||
|
image_data_32 image(w,h);
|
||||||
|
reader->read(start_x,start_y,image);
|
||||||
|
feature->set_raster(mapnik::raster_ptr(new raster(intersect,image)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
Loading…
Reference in a new issue