Don't put a comma between features in filter output

This commit is contained in:
Eric Fischer 2016-12-08 11:14:06 -08:00
parent 8cf81483b1
commit 6530e155eb
4 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
within = 0;
}
layer_to_geojson(stdout, layer, z, x, y);
layer_to_geojson(stdout, layer, z, x, y, true);
if (describe) {
printf("] }\n");

View File

@ -41,7 +41,7 @@ void *run_writer(void *a) {
exit(EXIT_FAILURE);
}
layer_to_geojson(fp, *(wa->layer), wa->z, wa->x, wa->y);
layer_to_geojson(fp, *(wa->layer), wa->z, wa->x, wa->y, false);
if (fclose(fp) != 0) {
perror("fclose output to filter");

View File

@ -24,11 +24,11 @@ struct lonlat {
}
};
void layer_to_geojson(FILE *fp, mvt_layer &layer, unsigned z, unsigned x, unsigned y) {
void layer_to_geojson(FILE *fp, mvt_layer &layer, unsigned z, unsigned x, unsigned y, bool comma) {
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature &feat = layer.features[f];
if (f != 0) {
if (comma && f != 0) {
fprintf(fp, ",\n");
}

View File

@ -1,2 +1,2 @@
void layer_to_geojson(FILE *fp, mvt_layer &layer, unsigned z, unsigned x, unsigned y);
void layer_to_geojson(FILE *fp, mvt_layer &layer, unsigned z, unsigned x, unsigned y, bool comma);
void fprintq(FILE *f, const char *s);