From c326762b6f46d830843567f6c42fcce47e33257f Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Sat, 27 Sep 2014 09:39:20 -0700 Subject: [PATCH] Crunch out spaces and most punctuation from autogenerated layer names --- geojson.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/geojson.c b/geojson.c index a77849c4..25af8342 100644 --- a/geojson.c +++ b/geojson.c @@ -620,8 +620,17 @@ next_feature: if (cp != NULL) { *cp = '\0'; } - printf("using layer name %s\n", trunc); layername = trunc; + + char *out = trunc; + for (cp = trunc; *cp; cp++) { + if (isalpha(*cp) || isdigit(*cp) || *cp == '_') { + *out++ = *cp; + } + } + *out = '\0'; + + printf("using layer name %s\n", trunc); } qsort(index, indexst.st_size / sizeof(struct index), sizeof(struct index), indexcmp);