mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Explicitly check for infinite and not-a-number input coordinates
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.28.1
|
||||||
|
|
||||||
|
* Explicitly check for infinite and not-a-number input coordinates
|
||||||
|
|
||||||
## 1.28.0
|
## 1.28.0
|
||||||
|
|
||||||
* Directly support gzipped GeoJSON as input files
|
* Directly support gzipped GeoJSON as input files
|
||||||
|
|||||||
@@ -14,6 +14,18 @@ struct projection *projection = &projections[0];
|
|||||||
|
|
||||||
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
|
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
|
||||||
void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y) {
|
void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y) {
|
||||||
|
// Place infinite and NaN coordinates off the edge of the Mercator plane
|
||||||
|
|
||||||
|
int lat_class = fpclassify(lat);
|
||||||
|
int lon_class = fpclassify(lon);
|
||||||
|
|
||||||
|
if (lat_class == FP_INFINITE || lat_class == FP_NAN) {
|
||||||
|
lat = 89.9;
|
||||||
|
}
|
||||||
|
if (lon_class == FP_INFINITE || lon_class == FP_NAN) {
|
||||||
|
lon = 360;
|
||||||
|
}
|
||||||
|
|
||||||
// Must limit latitude somewhere to prevent overflow.
|
// Must limit latitude somewhere to prevent overflow.
|
||||||
// 89.9 degrees latitude is 0.621 worlds beyond the edge of the flat earth,
|
// 89.9 degrees latitude is 0.621 worlds beyond the edge of the flat earth,
|
||||||
// hopefully far enough out that there are few expectations about the shape.
|
// hopefully far enough out that there are few expectations about the shape.
|
||||||
@@ -49,6 +61,18 @@ void tile2lonlat(long long x, long long y, int zoom, double *lon, double *lat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void epsg3857totile(double ix, double iy, int zoom, long long *x, long long *y) {
|
void epsg3857totile(double ix, double iy, int zoom, long long *x, long long *y) {
|
||||||
|
// Place infinite and NaN coordinates off the edge of the Mercator plane
|
||||||
|
|
||||||
|
int iy_class = fpclassify(iy);
|
||||||
|
int ix_class = fpclassify(ix);
|
||||||
|
|
||||||
|
if (iy_class == FP_INFINITE || iy_class == FP_NAN) {
|
||||||
|
iy = 40000000.0;
|
||||||
|
}
|
||||||
|
if (ix_class == FP_INFINITE || ix_class == FP_NAN) {
|
||||||
|
ix = 40000000.0;
|
||||||
|
}
|
||||||
|
|
||||||
*x = ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);
|
*x = ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);
|
||||||
*y = ((1LL << 32) - 1) - (iy * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31));
|
*y = ((1LL << 32) - 1) - (iy * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31));
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#ifndef VERSION_HPP
|
#ifndef VERSION_HPP
|
||||||
#define VERSION_HPP
|
#define VERSION_HPP
|
||||||
|
|
||||||
#define VERSION "tippecanoe v1.28.0\n"
|
#define VERSION "tippecanoe v1.28.1\n"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user