From 7f24cd6767be123593c44bd7dff08331bc39907e Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 2 Nov 2015 14:03:45 -0800 Subject: [PATCH] Don't produce layers with no features. Say "layer" instead of "name" in decode. --- decode.cc | 2 +- tile.cc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/decode.cc b/decode.cc index 693abc9..16738c0 100644 --- a/decode.cc +++ b/decode.cc @@ -115,7 +115,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) { } printf("{ \"type\": \"FeatureCollection\""); - printf(", \"properties\": { \"name\": "); + printf(", \"properties\": { \"layer\": "); printq(layer.name().c_str()); printf(" }"); printf(", \"features\": [\n"); diff --git a/tile.cc b/tile.cc index d956a0a..ee1c928 100644 --- a/tile.cc +++ b/tile.cc @@ -246,6 +246,10 @@ mapnik::vector::tile create_tile(char **layernames, int line_detail, std::vector int i; for (i = 0; i < nlayers; i++) { + if (features[i].size() == 0) { + continue; + } + mapnik::vector::tile_layer *layer = tile.add_layers(); layer->set_name(layernames[i]);