extract_bounding_box - fail on nested "FeatureCollection" elements
This commit is contained in:
parent
47c93eaf15
commit
6aca4b17f8
2 changed files with 17 additions and 14 deletions
|
@ -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\"")
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue