mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Merge pull request #570 from mapbox/nan-coordinates
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));
|
||||||
|
|
||||||
|
|||||||
@@ -243,3 +243,7 @@ scalerank,natscale,labelrank,featurecla,name,namepar,namealt,diffascii,nameascii
|
|||||||
0,600,0,Admin-0 capital,Singapore,,,0,Singapore,1.00000000000,,,1.00000000000,1,Singapore,SGP,Singapore,SGP,,SG,,1.29303346649,103.85582067800,0.00000000000,0,,5183700,3289529,3314179,13,12,1880252.00000000000,Singapore,Singapore,1,5,2.1
|
0,600,0,Admin-0 capital,Singapore,,,0,Singapore,1.00000000000,,,1.00000000000,1,Singapore,SGP,Singapore,SGP,,SG,,1.29303346649,103.85582067800,0.00000000000,0,,5183700,3289529,3314179,13,12,1880252.00000000000,Singapore,Singapore,1,5,2.1
|
||||||
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,22.30498089500,114.18500931700,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,22.30498089500,114.18500931700,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
|
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,nan,114.18500931700,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
||||||
|
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,inf,114.18500931700,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
||||||
|
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,22.30498089500,nan,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
||||||
|
0,600,0,Admin-0 region capital,Hong Kong,,,0,Hong Kong,0.00000000000,,,1.00000000000,1,China,CHN,Hong Kong S.A.R.,HKG,,HK,,22.30498089500,inf,0.00000000000,0,,7206000,4551579,4549026,13,12,1819729.00000000000,Hong Kong,Hong Kong,1,0,3.0
|
||||||
|
|||||||
|
File diff suppressed because one or more lines are too long
+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