mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 12:05:05 +00:00
Merge pull request #748 from mapbox/high-longitude
Be more consistent about when longitudes beyond 180 are allowed
This commit is contained in:
commit
363d21bfc1
@ -1,3 +1,8 @@
|
||||
## 1.34.2
|
||||
|
||||
* Be more consistent about when longitudes beyond 180 are allowed.
|
||||
Now if the entire feature is beyond 180, it will still appear.
|
||||
|
||||
## 1.34.1
|
||||
|
||||
* Don't run shell filters if the current zoom is below the minzoom
|
||||
|
@ -22,12 +22,17 @@ void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y) {
|
||||
|
||||
int lat_class = fpclassify(lat);
|
||||
int lon_class = fpclassify(lon);
|
||||
bool bad_lon = false;
|
||||
|
||||
if (lat_class == FP_INFINITE || lat_class == FP_NAN) {
|
||||
lat = 89.9;
|
||||
}
|
||||
if (lon_class == FP_INFINITE || lon_class == FP_NAN) {
|
||||
lon = 360;
|
||||
// Keep these far enough from the plane that they don't get
|
||||
// moved back into it by 360-degree offsetting
|
||||
|
||||
lon = 720;
|
||||
bad_lon = true;
|
||||
}
|
||||
|
||||
// Must limit latitude somewhere to prevent overflow.
|
||||
@ -40,10 +45,10 @@ void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y) {
|
||||
lat = 89.9;
|
||||
}
|
||||
|
||||
if (lon < -360) {
|
||||
if (lon < -360 && !bad_lon) {
|
||||
lon = -360;
|
||||
}
|
||||
if (lon > 360) {
|
||||
if (lon > 360 && !bad_lon) {
|
||||
lon = 360;
|
||||
}
|
||||
|
||||
|
1
tests/high-longitude/in.json
Normal file
1
tests/high-longitude/in.json
Normal file
@ -0,0 +1 @@
|
||||
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "hpa": 103200 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [254,35], [204,35], [204,30], [254,30], [254,35] ] ] } } ] }
|
25
tests/high-longitude/out/-z1.json
Normal file
25
tests/high-longitude/out/-z1.json
Normal file
@ -0,0 +1,25 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"bounds": "-180.000000,30.000000,180.000000,35.000000",
|
||||
"center": "-90.000000,35.000000,1",
|
||||
"description": "tests/high-longitude/out/-z1.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/high-longitude/out/-z1.json.check.mbtiles -z1 tests/high-longitude/in.json",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 1, \"fields\": {\"hpa\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 1,\"geometry\": \"LineString\",\"attributeCount\": 1,\"attributes\": [{\"attribute\": \"hpa\",\"count\": 1,\"type\": \"number\",\"values\": [103200],\"min\": 103200,\"max\": 103200}]}]}}",
|
||||
"maxzoom": "1",
|
||||
"minzoom": "0",
|
||||
"name": "tests/high-longitude/out/-z1.json.check.mbtiles",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "hpa": 103200 }, "geometry": { "type": "LineString", "coordinates": [ [ -106.083984, 35.029996 ], [ -156.005859, 35.029996 ], [ -156.005859, 30.069094 ], [ -106.083984, 30.069094 ], [ -106.083984, 35.029996 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "hpa": 103200 }, "geometry": { "type": "LineString", "coordinates": [ [ -106.040039, 35.029996 ], [ -156.005859, 35.029996 ], [ -156.005859, 30.031055 ], [ -106.040039, 30.031055 ], [ -106.040039, 35.029996 ] ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
7
tile.cpp
7
tile.cpp
@ -1214,9 +1214,6 @@ struct write_tile_args {
|
||||
|
||||
bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
int quick = quick_check(sf.bbox, z, buffer);
|
||||
if (quick == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (z == 0) {
|
||||
if (sf.bbox[0] <= (1LL << 32) * buffer / 256 || sf.bbox[2] >= (1LL << 32) - ((1LL << 32) * buffer / 256)) {
|
||||
@ -1244,6 +1241,10 @@ bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
if (quick == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Can't accept the quick check if guaranteeing no duplication, since the
|
||||
// overlap might have been in the buffer.
|
||||
if (quick != 1 || prevent[P_DUPLICATION]) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v1.34.1"
|
||||
#define VERSION "v1.34.2"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user