extract_bounding_box - fail on nested "FeatureCollection" elements

This commit is contained in:
artemp 2015-11-03 13:31:46 +00:00
parent 47c93eaf15
commit 6aca4b17f8
2 changed files with 17 additions and 14 deletions

View file

@ -65,22 +65,25 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
;
features = no_skip[iter_pos[_a = _1]] >> -(lit('{')
>> *((json.key_value - lit("\"features\"")) >> lit(','))
>> lit("\"features\"")
>> lit(':'))
>> lit('[') >> (feature(_r1,_a) % lit(',')) >> lit(']')
>> *((json.key_value - lit("\"features\"")) >> lit(','))
>> lit("\"features\"")
>> lit(':'))
>> lit('[') >> (feature(_r1,_a) % lit(',')) >> lit(']')
;
feature = raw[lit('{')[_a = 1]
>> *(eps(_a > 0) >> (lit('{')[_a += 1]
|
lit('}')[_a -=1]
|
coords[_b = _1]
|
json.string_
|
char_))][push_box(_r1, _r2, _b, _1)]
>> *(eps(_a > 0) >> (
lit("\"FeatureCollection\"") > eps(false) // fail if nested FeatureCollection
|
lit('{')[_a += 1]
|
lit('}')[_a -= 1]
|
coords[_b = _1]
|
json.string_
|
char_))][push_box(_r1, _r2, _b, _1)]
;
coords = lit("\"coordinates\"")

View file

@ -94,7 +94,7 @@ std::pair<bool,box2d<double>> process_geojson_file(T & boxes, std::string const&
}
catch (std::exception const& ex)
{
std::clog << "mapnik-index:" << ex.what() << std::endl;
std::clog << "mapnik-index (GeoJSON): " << ex.what() << std::endl;
}
for (auto const& item : boxes)
{