mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Fix encoding of attribute values. They do have their own pool.
This commit is contained in:
@@ -138,6 +138,12 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned
|
|||||||
keys.head = NULL;
|
keys.head = NULL;
|
||||||
keys.tail = NULL;
|
keys.tail = NULL;
|
||||||
|
|
||||||
|
struct pool values;
|
||||||
|
values.n = 0;
|
||||||
|
values.vals = NULL;
|
||||||
|
values.head = NULL;
|
||||||
|
values.tail = NULL;
|
||||||
|
|
||||||
struct index *i;
|
struct index *i;
|
||||||
for (i = start; i < end; i++) {
|
for (i = start; i < end; i++) {
|
||||||
int t;
|
int t;
|
||||||
@@ -171,7 +177,7 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned
|
|||||||
int t;
|
int t;
|
||||||
deserialize_int(&meta, &t);
|
deserialize_int(&meta, &t);
|
||||||
struct pool_val *key = deserialize_string(&meta, &keys, VT_STRING);
|
struct pool_val *key = deserialize_string(&meta, &keys, VT_STRING);
|
||||||
struct pool_val *value = deserialize_string(&meta, &keys, t);
|
struct pool_val *value = deserialize_string(&meta, &values, t);
|
||||||
|
|
||||||
feature->add_tags(key->n);
|
feature->add_tags(key->n);
|
||||||
feature->add_tags(value->n);
|
feature->add_tags(value->n);
|
||||||
@@ -183,6 +189,15 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned
|
|||||||
for (pv = keys.head; pv != NULL; pv = pv->next) {
|
for (pv = keys.head; pv != NULL; pv = pv->next) {
|
||||||
layer->add_keys(pv->s, strlen(pv->s));
|
layer->add_keys(pv->s, strlen(pv->s));
|
||||||
}
|
}
|
||||||
|
for (pv = values.head; pv != NULL; pv = pv->next) {
|
||||||
|
mapnik::vector::tile_value *tv = layer->add_values();
|
||||||
|
|
||||||
|
if (pv->type == VT_NUMBER) {
|
||||||
|
tv->set_double_value(atof(pv->s));
|
||||||
|
} else {
|
||||||
|
tv->set_string_value(pv->s);
|
||||||
|
}
|
||||||
|
}
|
||||||
pool_free(&keys);
|
pool_free(&keys);
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|||||||
Reference in New Issue
Block a user