Round coordinates instead of truncating them (#60)

* Round coordinates instead of truncating them

* Update all the tests for coordinate rounding changes

* Curses, integer division still truncates

* Fix tests

* Also round instead of shifting when looking for no-op linetos

* Should I worry that the same change for moveto doesn't change any tests?

* Also round instead of shifting when scaling down to maxzoom resolution

* Replace another explicit shift, for origin point

* Round instead of shift when writing clipped geometries to the next zoom

* Fix low-zoom gridding and smaller-than-a-pixel checks

* Don't guess an excessively large maxzoom when there is only one feature

* Add a test for guessing the maxzoom of a single point

* Explicitly sort by index if no other order distinguishes features

* Another affected test
This commit is contained in:
Erica Fischer
2023-01-27 10:57:22 -08:00
committed by GitHub
parent 1c576c2dc1
commit c58a8e3b97
181 changed files with 166358 additions and 165951 deletions
+6 -6
View File
@@ -14,25 +14,25 @@
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.052734, 83.004844 ], [ -82.001953, 82.009169 ], [ -106.083984, 70.020587 ], [ -103.007812, 32.026706 ], [ -82.001953, -32.990236 ], [ -63.017578, -62.995158 ], [ -28.037109, -72.996909 ], [ 90.000000, -73.995328 ], [ 144.931641, -73.995328 ], [ 144.931641, -76.999935 ], [ 92.988281, -78.988187 ], [ -33.046875, -76.999935 ], [ -75.058594, -65.982270 ], [ -97.031250, -37.996163 ], [ -118.037109, 26.037042 ], [ -117.070312, 71.016960 ], [ -99.052734, 83.004844 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -98.964844, 82.994132 ], [ -82.001953, 81.996942 ], [ -105.996094, 69.990535 ], [ -103.007812, 32.026706 ], [ -82.001953, -32.990236 ], [ -63.017578, -62.995158 ], [ -27.949219, -72.996909 ], [ 90.000000, -73.995328 ], [ 145.019531, -73.995328 ], [ 145.019531, -76.999935 ], [ 92.988281, -79.004962 ], [ -32.958984, -76.999935 ], [ -74.970703, -66.018018 ], [ -97.031250, -37.996163 ], [ -117.949219, 25.958045 ], [ -116.982422, 70.988349 ], [ -98.964844, 82.994132 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 108.984375, 83.004844 ], [ 135.000000, 80.012423 ], [ -88.066406, 80.012423 ], [ -119.003906, 71.016960 ], [ -112.060547, -74.982183 ], [ -92.021484, -76.999935 ], [ 169.980469, -79.997168 ], [ 159.960938, -81.996942 ], [ -111.005859, -81.996942 ], [ -139.042969, -75.994839 ], [ -139.042969, 74.019543 ], [ -101.074219, 83.004844 ], [ 108.984375, 83.004844 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 108.984375, 82.994132 ], [ 135.000000, 79.997168 ], [ -87.978516, 79.997168 ], [ -119.003906, 70.988349 ], [ -111.972656, -75.004940 ], [ -92.021484, -76.999935 ], [ 169.980469, -79.997168 ], [ 160.048828, -81.996942 ], [ -111.005859, -81.996942 ], [ -138.955078, -75.994839 ], [ -138.955078, 73.995328 ], [ -100.986328, 82.994132 ], [ 108.984375, 82.994132 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.008789, 83.004844 ], [ -82.001953, 82.003058 ], [ -106.040039, 70.005567 ], [ -103.007812, 32.026706 ], [ -82.001953, -32.990236 ], [ -63.017578, -62.995158 ], [ -28.037109, -72.996909 ], [ 90.000000, -73.995328 ], [ 144.975586, -73.995328 ], [ 144.975586, -76.999935 ], [ 92.988281, -78.996578 ], [ -33.002930, -76.999935 ], [ -75.014648, -65.982270 ], [ -97.031250, -37.996163 ], [ -118.037109, 26.037042 ], [ -117.026367, 71.002660 ], [ -99.008789, 83.004844 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.008789, 82.999490 ], [ -82.001953, 81.996942 ], [ -105.996094, 69.990535 ], [ -103.007812, 31.989442 ], [ -82.001953, -33.027088 ], [ -63.017578, -62.995158 ], [ -27.993164, -72.996909 ], [ 90.000000, -74.007440 ], [ 145.019531, -74.007440 ], [ 145.019531, -76.999935 ], [ 93.032227, -79.004962 ], [ -33.002930, -76.999935 ], [ -75.014648, -66.000150 ], [ -97.031250, -37.996163 ], [ -117.993164, 25.997550 ], [ -117.026367, 71.002660 ], [ -99.008789, 82.999490 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 108.984375, 83.004844 ], [ 135.000000, 80.004799 ], [ -88.022461, 80.004799 ], [ -119.003906, 71.002660 ], [ -112.016602, -74.993566 ], [ -92.021484, -76.999935 ], [ 169.980469, -79.997168 ], [ 159.960938, -81.996942 ], [ -111.005859, -81.996942 ], [ -139.042969, -75.994839 ], [ -139.042969, 74.007440 ], [ -101.030273, 83.004844 ], [ 108.984375, 83.004844 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 109.028320, 82.999490 ], [ 135.000000, 79.997168 ], [ -88.022461, 79.997168 ], [ -119.003906, 71.002660 ], [ -112.016602, -75.004940 ], [ -92.021484, -76.999935 ], [ 170.024414, -80.004799 ], [ 160.004883, -82.003058 ], [ -111.005859, -82.003058 ], [ -138.999023, -76.005470 ], [ -138.999023, 73.995328 ], [ -101.030273, 82.999490 ], [ 109.028320, 82.999490 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 2, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.008789, 83.002167 ], [ -82.001953, 82.000000 ], [ -106.018066, 70.005567 ], [ -103.007812, 32.008076 ], [ -82.001953, -32.990236 ], [ -63.017578, -62.995158 ], [ -28.015137, -72.996909 ], [ 90.000000, -73.995328 ], [ 144.997559, -73.995328 ], [ 144.997559, -76.999935 ], [ 92.988281, -78.996578 ], [ -33.002930, -76.999935 ], [ -75.014648, -65.991212 ], [ -97.009277, -37.996163 ], [ -118.015137, 26.017298 ], [ -117.004395, 71.002660 ], [ -99.008789, 83.002167 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.008789, 82.999490 ], [ -82.001953, 82.000000 ], [ -105.996094, 69.998052 ], [ -103.007812, 32.008076 ], [ -82.001953, -33.008663 ], [ -62.995605, -62.995158 ], [ -27.993164, -72.996909 ], [ 90.000000, -74.001385 ], [ 144.997559, -74.001385 ], [ 144.997559, -76.999935 ], [ 93.010254, -79.000771 ], [ -33.002930, -76.999935 ], [ -74.992676, -66.000150 ], [ -97.009277, -37.996163 ], [ -117.993164, 25.997550 ], [ -117.004395, 71.002660 ], [ -99.008789, 82.999490 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 108.984375, 83.002167 ], [ 135.000000, 80.000984 ], [ -88.000488, 80.000984 ], [ -119.003906, 71.002660 ], [ -112.016602, -74.999254 ], [ -92.021484, -76.999935 ], [ 169.980469, -79.997168 ], [ 159.982910, -81.996942 ], [ -111.005859, -81.996942 ], [ -139.020996, -75.994839 ], [ -139.020996, 74.001385 ], [ -101.008301, 83.002167 ], [ 108.984375, 83.002167 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 109.006348, 82.999490 ], [ 135.000000, 80.000984 ], [ -88.000488, 80.000984 ], [ -119.003906, 71.002660 ], [ -111.994629, -74.999254 ], [ -91.999512, -76.999935 ], [ 170.002441, -80.000984 ], [ 160.004883, -82.000000 ], [ -111.005859, -82.000000 ], [ -138.999023, -76.000156 ], [ -138.999023, 74.001385 ], [ -101.008301, 82.999490 ], [ 109.006348, 82.999490 ] ] ] } }
] }
] }
] }