Simplify the filter format, and actually run the filter.

This commit is contained in:
Eric Fischer
2017-08-28 13:42:14 -07:00
parent 7be21f6046
commit 5878213516
7 changed files with 49 additions and 19 deletions
+1 -13
View File
@@ -174,19 +174,7 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f) {
}
bool evaluate(std::map<std::string, mvt_value> const &feature, std::string const &layer, json_object *filter) {
json_object *layers = json_hash_get(filter, "layers");
if (layers == NULL) {
fprintf(stderr, "Filter: no \"layers\" key at top level\n");
exit(EXIT_FAILURE);
}
if (layers->type != JSON_HASH) {
fprintf(stderr, "Filter: \"layers\" is not a hash\n");
exit(EXIT_FAILURE);
}
json_object *f = json_hash_get(layers, layer.c_str());
json_object *f = json_hash_get(filter, layer.c_str());
if (f != NULL) {
return eval(feature, f);