From 3170616f6d8b842fe391fb22e006c5ee4cbac882 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 23 Sep 2014 11:41:36 -0700 Subject: [PATCH] Fix encoding of attribute values. They do have their own pool. --- tile.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tile.cc b/tile.cc index 83d31999..d791b212 100644 --- a/tile.cc +++ b/tile.cc @@ -138,6 +138,12 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned keys.head = NULL; keys.tail = NULL; + struct pool values; + values.n = 0; + values.vals = NULL; + values.head = NULL; + values.tail = NULL; + struct index *i; for (i = start; i < end; i++) { int t; @@ -171,7 +177,7 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned int t; deserialize_int(&meta, &t); 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(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) { 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); std::string s;