mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Require that per-feature maxzoom and minzoom be small integers
Also fixes a place in the Makefile that accidentally still used CFLAGS instead of CXXFLAGS
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "text.hpp"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Returns an empty string if `s` is valid utf8;
|
||||
@@ -122,3 +124,12 @@ std::string truncate16(std::string const &s, size_t runes) {
|
||||
|
||||
return std::string(s, 0, lastgood - start);
|
||||
}
|
||||
|
||||
int integer_zoom(std::string where, std::string text) {
|
||||
double d = atof(text.c_str());
|
||||
if (!isnormal(d) || d != floor(d) || d < 0 || d > 32) {
|
||||
fprintf(stderr, "%s: Expected integer zoom level in \"tippecanoe\" GeoJSON extension, not %s\n", where.c_str(), text.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user