geojson bounding box grammar - don't require "type": "Feature" to appear in particular order (ref #2745)

This commit is contained in:
artemp 2015-03-27 10:32:52 +01:00
parent 8c93d05796
commit 51b65534f5

View file

@ -62,6 +62,7 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
start = features(_r1)
;
features = iter_pos[_a = _1] >> -(lit('{') >> -lit("\"type\"")
>> lit(':') >> lit("\"FeatureCollection\"")
>> *(lit(',') >> (json.key_value - lit("\"features\"")))
@ -69,7 +70,8 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
>> lit(':'))
>> lit('[') >> (feature(_r1,_a) % lit(',')) >> lit(']')
;
feature = raw[lit('{')[_a = 1] >> lit("\"type\"") >> lit(':') >> lit("\"Feature\"")
feature = raw[lit('{')[_a = 1]
>> *(eps(_a > 0) >> (lit('{')[_a += 1]
|
lit('}')[_a -=1]
@ -78,36 +80,48 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
char_))][push_box(_r1, _r2, _b, _1)]
;
coords = lit("\"coordinates\"") >> lit(':') >> (rings_array(_a) | rings (_a) | ring(_a) | pos[calculate_bounding_box(_a,_1)])[_val = _a]
coords = lit("\"coordinates\"")
>> lit(':') >> (rings_array(_a) | rings (_a) | ring(_a) | pos[calculate_bounding_box(_a,_1)])[_val = _a]
;
pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
;
ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']')
;
rings = lit('[') >> ring(_r1) % lit(',') > lit(']')
;
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
;
// generic json types
json.value = json.object | json.array | json.string_ | json.number
;
json.pairs = json.key_value % lit(',')
;
json.key_value = (json.string_ >> lit(':') >> json.value)
;
json.object = lit('{') >> *json.pairs >> lit('}')
;
json.array = lit('[')
>> json.value >> *(lit(',') >> json.value)
>> lit(']')
;
json.number = json.strict_double
| json.int__
| lit("true")
| lit("false")
| lit("null")
;
coords.name("Coordinates");
pos.name("Position");
ring.name("Ring");