From 538af2515d390fc668a3faf6dd1877831ea8fc4c Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 31 Jan 2014 19:12:31 -0800 Subject: [PATCH] fix rendering of multiple styles with OGR plugin - refs #2048 and mapbox/tilemill#2202 --- plugins/input/ogr/ogr_featureset.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/input/ogr/ogr_featureset.cpp b/plugins/input/ogr/ogr_featureset.cpp index 220e8e05c..b2a3d55f7 100644 --- a/plugins/input/ogr/ogr_featureset.cpp +++ b/plugins/input/ogr/ogr_featureset.cpp @@ -52,7 +52,7 @@ ogr_featureset::ogr_featureset(mapnik::context_ptr const& ctx, layer_(layer), layerdef_(layer.GetLayerDefn()), tr_(new transcoder(encoding)), - fidcolumn_(layer_.GetFIDColumn()), + fidcolumn_(layer_.GetFIDColumn()), // TODO - unused count_(0) { layer_.SetSpatialFilterRect (extent.minx(), @@ -67,6 +67,13 @@ ogr_featureset::~ogr_featureset() feature_ptr ogr_featureset::next() { + if (count_ == 0) + { + // Reset the layer reading on the first feature read + // this is a hack, but needed due to https://github.com/mapnik/mapnik/issues/2048 + // Proper solution is to avoid storing layer state in featureset + layer_.ResetReading(); + } OGRFeature *poFeature; while ((poFeature = layer_.GetNextFeature()) != nullptr) {