Merge files into one layer if a name is specified with -l

This commit is contained in:
Eric Fischer
2015-10-30 17:30:18 -07:00
parent 0b6f6436a6
commit d13f60e9c4
4 changed files with 50 additions and 13 deletions
+19
View File
@@ -109,6 +109,20 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
mapnik::vector::tile_layer layer = tile.layers(l);
int extent = layer.extent();
if (describe) {
if (l != 0) {
printf(",\n");
}
printf("{ \"type\": \"FeatureCollection\"");
printf(", \"properties\": { \"name\": ");
printq(layer.name().c_str());
printf(" }");
printf(", \"features\": [\n");
within = 0;
}
for (int f = 0; f < layer.features_size(); f++) {
mapnik::vector::tile_feature feat = layer.features(f);
int px = 0, py = 0;
@@ -275,6 +289,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
int state = 0;
for (unsigned i = 0; i < rings.size(); i++) {
printf("AREA %f ", areas[i]);
if (areas[i] <= 0) {
if (state != 0) {
// new multipolygon
@@ -316,6 +331,10 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
printf(" } }\n");
}
if (describe) {
printf("] }\n");
}
}
printf("] }\n");