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
+45 -21
View File
@@ -11,129 +11,153 @@
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 7, "x": 20, "y": 49 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822342, 38.090256 ], [ -122.822342, 38.090796 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 8, "x": 40, "y": 98 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822342, 38.090526 ], [ -122.822342, 38.090796 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -122.591286, 38.087554 ], [ -122.590942, 38.087554 ] ], [ [ -122.437820, 37.722935 ], [ -122.437820, 37.723207 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 9, "x": 81, "y": 198 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437992, 37.723071 ], [ -122.437820, 37.723071 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 9, "x": 81, "y": 197 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -122.822342, 38.090526 ], [ -122.822342, 38.090661 ] ], [ [ -122.591286, 38.087689 ], [ -122.591114, 38.087689 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437992, 37.723071 ], [ -122.437820, 37.723071 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 9, "x": 82, "y": 197 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.249851, 37.793372 ], [ -122.249851, 37.793236 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 10, "x": 162, "y": 394 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822256, 38.090526 ], [ -122.822256, 38.090594 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822256, 38.090526 ], [ -122.822170, 38.090526 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 10, "x": 163, "y": 396 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437992, 37.723139 ], [ -122.437906, 37.723139 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437906, 37.723071 ], [ -122.437906, 37.723139 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 10, "x": 163, "y": 395 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437992, 37.723139 ], [ -122.437906, 37.723139 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437906, 37.723071 ], [ -122.437906, 37.723139 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 10, "x": 163, "y": 394 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591200, 38.087621 ], [ -122.591114, 38.087621 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591114, 38.087621 ], [ -122.591114, 38.087554 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 325, "y": 789 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822256, 38.090526 ], [ -122.822213, 38.090560 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822213, 38.090492 ], [ -122.822170, 38.090526 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 326, "y": 789 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591157, 38.087621 ], [ -122.591114, 38.087587 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591114, 38.087621 ], [ -122.591114, 38.087587 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 327, "y": 791 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437949, 37.723105 ], [ -122.437906, 37.723139 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437906, 37.723071 ], [ -122.437906, 37.723105 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 328, "y": 791 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.249808, 37.793304 ], [ -122.249765, 37.793338 ], [ -122.249808, 37.793304 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 12, "x": 650, "y": 1578 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090509 ], [ -122.822213, 38.090543 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090509 ], [ -122.822192, 38.090526 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 12, "x": 653, "y": 1578 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591136, 38.087621 ], [ -122.591114, 38.087587 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591114, 38.087621 ], [ -122.591093, 38.087571 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 12, "x": 654, "y": 1583 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437928, 37.723088 ], [ -122.437906, 37.723122 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437928, 37.723071 ], [ -122.437885, 37.723105 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 12, "x": 657, "y": 1582 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.249787, 37.793338 ], [ -122.249830, 37.793321 ], [ -122.249787, 37.793338 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.249830, 37.793304 ], [ -122.249787, 37.793338 ], [ -122.249830, 37.793304 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 1301, "y": 3157 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090509 ], [ -122.822202, 38.090534 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090501 ], [ -122.822192, 38.090534 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 1306, "y": 3157 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591136, 38.087621 ], [ -122.591103, 38.087587 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591125, 38.087613 ], [ -122.591093, 38.087579 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 1309, "y": 3167 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437928, 37.723080 ], [ -122.437906, 37.723114 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437917, 37.723071 ], [ -122.437896, 37.723105 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 1314, "y": 3165 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.249787, 37.793338 ], [ -122.249830, 37.793313 ], [ -122.249787, 37.793338 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -122.249819, 37.793304 ], [ -122.249776, 37.793338 ] ], [ [ -122.249776, 37.793330 ], [ -122.249819, 37.793304 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 14, "x": 2602, "y": 6314 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090505 ], [ -122.822197, 38.090534 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.822235, 38.090505 ], [ -122.822192, 38.090534 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 14, "x": 2612, "y": 6314 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591130, 38.087621 ], [ -122.591103, 38.087583 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.591125, 38.087617 ], [ -122.591098, 38.087579 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 14, "x": 2619, "y": 6335 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437928, 37.723075 ], [ -122.437901, 37.723114 ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ -122.437922, 37.723071 ], [ -122.437896, 37.723109 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 14, "x": 2628, "y": 6331 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -122.249787, 37.793338 ], [ -122.249830, 37.793308 ] ], [ [ -122.249824, 37.793308 ], [ -122.249787, 37.793338 ] ] ] } }
{ "type": "Feature", "properties": { }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -122.249824, 37.793308 ], [ -122.249781, 37.793338 ] ], [ [ -122.249781, 37.793334 ], [ -122.249824, 37.793304 ] ] ] } }
] }
] }
] }