From c053682711027793df8eaa55178e94e38e5d05a1 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 20 Oct 2015 11:12:11 +0100 Subject: [PATCH] geojson.input - assign incremental feature_id in geojson_index_featureset and geojson_memory_index_featureset (ref #3134) --- plugins/input/geojson/geojson_index_featureset.cpp | 2 +- plugins/input/geojson/geojson_index_featureset.hpp | 1 + plugins/input/geojson/geojson_memory_index_featureset.cpp | 2 +- plugins/input/geojson/geojson_memory_index_featureset.hpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/input/geojson/geojson_index_featureset.cpp b/plugins/input/geojson/geojson_index_featureset.cpp index f5d4249fb..285691607 100644 --- a/plugins/input/geojson/geojson_index_featureset.cpp +++ b/plugins/input/geojson/geojson_index_featureset.cpp @@ -93,7 +93,7 @@ mapnik::feature_ptr geojson_index_featureset::next() static const mapnik::json::feature_grammar grammar(tr); using namespace boost::spirit; standard::space_type space; - mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1)); + mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_, feature_id_++)); if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space) || start != end) { throw std::runtime_error("Failed to parse geojson feature"); diff --git a/plugins/input/geojson/geojson_index_featureset.hpp b/plugins/input/geojson/geojson_index_featureset.hpp index e683df28d..ea7b9127d 100644 --- a/plugins/input/geojson/geojson_index_featureset.hpp +++ b/plugins/input/geojson/geojson_index_featureset.hpp @@ -56,6 +56,7 @@ private: using file_ptr = std::unique_ptr; file_ptr file_; #endif + std::size_t feature_id_ = 1; mapnik::context_ptr ctx_; std::vector positions_; std::vector::iterator itr_; diff --git a/plugins/input/geojson/geojson_memory_index_featureset.cpp b/plugins/input/geojson/geojson_memory_index_featureset.cpp index 14a1a6c14..99a79ff39 100644 --- a/plugins/input/geojson/geojson_memory_index_featureset.cpp +++ b/plugins/input/geojson/geojson_memory_index_featureset.cpp @@ -69,7 +69,7 @@ mapnik::feature_ptr geojson_memory_index_featureset::next() static const mapnik::json::feature_grammar grammar(tr); using namespace boost::spirit; standard::space_type space; - mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1)); + mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_, feature_id_++)); if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space) || start != end) { throw std::runtime_error("Failed to parse geojson feature"); diff --git a/plugins/input/geojson/geojson_memory_index_featureset.hpp b/plugins/input/geojson/geojson_memory_index_featureset.hpp index 154460c58..25f4a2f3c 100644 --- a/plugins/input/geojson/geojson_memory_index_featureset.hpp +++ b/plugins/input/geojson/geojson_memory_index_featureset.hpp @@ -42,7 +42,7 @@ public: private: file_ptr file_; - + std::size_t feature_id_ = 1; const array_type index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_;