geojson.input - assign incremental feature_id in geojson_index_featureset and geojson_memory_index_featureset

(ref #3134)
This commit is contained in:
artemp 2015-10-20 11:12:11 +01:00
parent d9a66a765c
commit c053682711
4 changed files with 4 additions and 3 deletions

View file

@ -93,7 +93,7 @@ mapnik::feature_ptr geojson_index_featureset::next()
static const mapnik::json::feature_grammar<char const*, mapnik::feature_impl> 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");

View file

@ -56,6 +56,7 @@ private:
using file_ptr = std::unique_ptr<std::FILE, int (*)(std::FILE *)>;
file_ptr file_;
#endif
std::size_t feature_id_ = 1;
mapnik::context_ptr ctx_;
std::vector<value_type> positions_;
std::vector<value_type>::iterator itr_;

View file

@ -69,7 +69,7 @@ mapnik::feature_ptr geojson_memory_index_featureset::next()
static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> 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");

View file

@ -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_;