From 4a5aebea43c4e8cf42a9965bad77501755574a51 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 31 Oct 2018 10:43:21 -0700 Subject: [PATCH] Change representation of null/true/false to match vector-tile-base --- mvt.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mvt.cpp b/mvt.cpp index e567a1a..85e2656 100644 --- a/mvt.cpp +++ b/mvt.cpp @@ -935,10 +935,10 @@ void mvt_layer::tag_v3_value(mvt_value value, std::vector &onto) } onto.push_back(vo); } else if (value.type == mvt_bool) { - vo = (value.numeric_value.bool_value << 4) | 7; + vo = ((value.numeric_value.bool_value + 1) << 4) | 7; onto.push_back(vo); } else if (value.type == mvt_null) { - vo = (2 << 4) | 7; + vo = (0 << 4) | 7; onto.push_back(vo); } else if (value.type == mvt_list) { bool all_ints = true; @@ -1137,12 +1137,12 @@ mvt_value mvt_layer::decode_property(std::vector const &property, return ret; case 7: /* boolean */ - if ((property[off] >> 4) == 2) { + if ((property[off] >> 4) == 0) { ret.type = mvt_null; ret.numeric_value.null_value = 0; } else { ret.type = mvt_bool; - ret.numeric_value.bool_value = property[off] >> 4; + ret.numeric_value.bool_value = (property[off] >> 4) - 1; } return ret;