mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-05-02 17:12:53 +00:00
Pass compound objects through the prefilter
This commit is contained in:
parent
9319f2e1b2
commit
900738dba1
18
tests/object/out/-Ccat_-z0.json
Normal file
18
tests/object/out/-Ccat_-z0.json
Normal file
@ -0,0 +1,18 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"bounds": "0.000000,0.000000,0.000000,0.000000",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/object/out/-Ccat_-z0.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"compound\": \"Mixed\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"compound\",\"count\": 1,\"type\": \"mixed\",\"values\": [\"{\\\"string\\\":\\\"string\\\",\\\"number\\\":10,\\\"null\\\":null,\\\"true\\\":true,\\\"false\\\":false,\\\"array\\\":[\\\"string\\\",10,null,true,false,[1,2,3],{\\\"this\\\":\\\"that\\\"}],\\\"emptylist\\\":[],\\\"emptyhash\\\":{},\\\"nest\\\":{\\\"something\\\":\\\"else\\\"}}\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/object/out/-Ccat_-z0.json.check.mbtiles",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "compound": {"string":"string","number":10,"null":null,"true":true,"false":false,"array":["string",10,null,true,false,[1,2,3],{"this":"that"}],"emptylist":[],"emptyhash":{},"nest":{"something":"else"}} }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
16
tile.cpp
16
tile.cpp
@ -2277,11 +2277,25 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
feature.has_id = layer_features[x].has_id;
|
||||
|
||||
decode_meta(layer_features[x].keys, layer_features[x].values, layer_features[x].stringpool, layer, feature, true);
|
||||
|
||||
for (size_t a = 0; a < layer_features[x].full_keys.size(); a++) {
|
||||
serial_val sv = layer_features[x].full_values[a];
|
||||
mvt_value v = stringified_to_mvt_value(sv.type, sv.s.c_str());
|
||||
|
||||
if (v.type != mvt_null) {
|
||||
if (v.type == mvt_hash) {
|
||||
json_pull *jp = json_begin_string((char *) v.string_value.c_str());
|
||||
json_object *jo = json_read_tree(jp);
|
||||
if (jo == NULL) {
|
||||
fprintf(stderr, "Internal error: failed to reconstruct JSON %s\n", v.string_value.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
size_t ko = layer.tag_key(layer_features[x].full_keys[a]);
|
||||
size_t vo = tag_object(layer, jo);
|
||||
feature.tags.push_back(ko);
|
||||
feature.tags.push_back(vo);
|
||||
json_free(jo);
|
||||
json_end(jp);
|
||||
} else if (v.type != mvt_null) {
|
||||
layer.tag(feature, layer_features[x].full_keys[a], v);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user