Use the same GeoJSON parsing loop in tippecanoe-json-tool

This commit is contained in:
Eric Fischer
2018-08-08 13:11:25 -07:00
parent 79363e397b
commit ba8966a4ae
4 changed files with 40 additions and 70 deletions
+10 -2
View File
@@ -233,8 +233,16 @@ struct json_serialize_action : json_feature_action {
int layer;
std::string layername;
int add_feature(json_object *geometry, json_object *properties, json_object *id, json_object *tippecanoe, json_object *feature) {
return serialize_geojson_feature(sst, geometry, properties, id, layer, tippecanoe, feature, layername);
int add_feature(json_object *geometry, bool geometrycollection, json_object *properties, json_object *id, json_object *tippecanoe, json_object *feature) {
if (geometrycollection) {
int ret = 1;
for (size_t g = 0; g < geometry->length; g++) {
ret &= serialize_geojson_feature(sst, geometry->array[g], properties, id, layer, tippecanoe, feature, layername);
}
return ret;
} else {
return serialize_geojson_feature(sst, geometry, properties, id, layer, tippecanoe, feature, layername);
}
}
void check_crs(json_object *j) {