geojson bounding box grammar - don't require "type": "Feature"
to appear in particular order (ref #2745)
This commit is contained in:
parent
8c93d05796
commit
51b65534f5
1 changed files with 23 additions and 9 deletions
|
@ -62,6 +62,7 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
||||||
|
|
||||||
start = features(_r1)
|
start = features(_r1)
|
||||||
;
|
;
|
||||||
|
|
||||||
features = iter_pos[_a = _1] >> -(lit('{') >> -lit("\"type\"")
|
features = iter_pos[_a = _1] >> -(lit('{') >> -lit("\"type\"")
|
||||||
>> lit(':') >> lit("\"FeatureCollection\"")
|
>> lit(':') >> lit("\"FeatureCollection\"")
|
||||||
>> *(lit(',') >> (json.key_value - lit("\"features\"")))
|
>> *(lit(',') >> (json.key_value - lit("\"features\"")))
|
||||||
|
@ -69,7 +70,8 @@ extract_bounding_box_grammar<Iterator, ErrorHandler>::extract_bounding_box_gramm
|
||||||
>> lit(':'))
|
>> lit(':'))
|
||||||
>> lit('[') >> (feature(_r1,_a) % lit(',')) >> 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]
|
>> *(eps(_a > 0) >> (lit('{')[_a += 1]
|
||||||
|
|
|
|
||||||
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)]
|
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(']')
|
pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']')
|
ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
rings = lit('[') >> ring(_r1) % lit(',') > lit(']')
|
rings = lit('[') >> ring(_r1) % lit(',') > lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
|
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
// generic json types
|
// generic json types
|
||||||
json.value = json.object | json.array | json.string_ | json.number
|
json.value = json.object | json.array | json.string_ | json.number
|
||||||
;
|
;
|
||||||
|
|
||||||
json.pairs = json.key_value % lit(',')
|
json.pairs = json.key_value % lit(',')
|
||||||
;
|
;
|
||||||
|
|
||||||
json.key_value = (json.string_ >> lit(':') >> json.value)
|
json.key_value = (json.string_ >> lit(':') >> json.value)
|
||||||
;
|
;
|
||||||
|
|
||||||
json.object = lit('{') >> *json.pairs >> lit('}')
|
json.object = lit('{') >> *json.pairs >> lit('}')
|
||||||
;
|
;
|
||||||
|
|
||||||
json.array = lit('[')
|
json.array = lit('[')
|
||||||
>> json.value >> *(lit(',') >> json.value)
|
>> json.value >> *(lit(',') >> json.value)
|
||||||
>> lit(']')
|
>> lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
json.number = json.strict_double
|
json.number = json.strict_double
|
||||||
| json.int__
|
| json.int__
|
||||||
| lit("true")
|
| lit("true")
|
||||||
| lit("false")
|
| lit("false")
|
||||||
| lit("null")
|
| lit("null")
|
||||||
;
|
;
|
||||||
|
|
||||||
coords.name("Coordinates");
|
coords.name("Coordinates");
|
||||||
pos.name("Position");
|
pos.name("Position");
|
||||||
ring.name("Ring");
|
ring.name("Ring");
|
||||||
|
|
Loading…
Add table
Reference in a new issue