mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Factor out conversion from JSON types to vector tile attribute types
This commit is contained in:
+6
-12
@@ -182,20 +182,14 @@ mvt_layer parse_layer(int fd, unsigned z, unsigned x, unsigned y, mvt_layer cons
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < properties->length; i++) {
|
||||
mvt_value v;
|
||||
int tp = -1;
|
||||
std::string s;
|
||||
|
||||
// XXX reconcile with JSON property parsing
|
||||
if (properties->values[i]->type == JSON_STRING) {
|
||||
v.type = mvt_string;
|
||||
v.string_value = std::string(properties->values[i]->string);
|
||||
} else if (properties->values[i]->type == JSON_NUMBER) {
|
||||
v.type = mvt_double;
|
||||
v.numeric_value.double_value = atof(properties->values[i]->string);
|
||||
} else {
|
||||
continue;
|
||||
stringify_value(properties->values[i], tp, s, "Filter output", jp->line, j);
|
||||
if (tp >= 0) {
|
||||
mvt_value v = stringified_to_mvt_value(tp, s.c_str());
|
||||
ret.tag(feature, std::string(properties->keys[i]->string), v);
|
||||
}
|
||||
|
||||
ret.tag(feature, std::string(properties->keys[i]->string), v);
|
||||
}
|
||||
|
||||
ret.features.push_back(feature);
|
||||
|
||||
Reference in New Issue
Block a user