morecantile 5.2.3__tar.gz → 5.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {morecantile-5.2.3 → morecantile-5.3.1}/PKG-INFO +2 -1
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/__init__.py +1 -1
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/models.py +21 -6
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/utils.py +24 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/pyproject.toml +16 -0
- morecantile-5.2.3/.bumpversion.cfg +0 -9
- {morecantile-5.2.3 → morecantile-5.3.1}/.gitignore +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/.pre-commit-config.yaml +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/LICENSE +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/README.md +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/commons.py +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/CDB1GlobalGrid.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/CanadianNAD83_LCC.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/EuropeanETRS89_LAEAQuad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/GNOSISGlobalGrid.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/LINZAntarticaMapTilegrid.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/NZTM2000Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/README.md +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/UPSAntarcticWGS84Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/UPSArcticWGS84Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/UTM31WGS84Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/WGS1984Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/WebMercatorQuad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/WorldCRS84Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/data/WorldMercatorWGS84Quad.json +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/defaults.py +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/errors.py +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/py.typed +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/scripts/__init__.py +0 -0
- {morecantile-5.2.3 → morecantile-5.3.1}/morecantile/scripts/cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: morecantile
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.1
|
|
4
4
|
Summary: Construct and use map tile grids (a.k.a TileMatrixSet / TMS).
|
|
5
5
|
Keywords: GIS,TMS,TileMatrixSet,Map Tile
|
|
6
6
|
Author-email: Vincent Sarago <vincent@developmentseed.com>
|
|
@@ -18,6 +18,7 @@ Requires-Dist: attrs
|
|
|
18
18
|
Requires-Dist: pyproj~=3.1
|
|
19
19
|
Requires-Dist: pydantic~=2.0
|
|
20
20
|
Requires-Dist: pre-commit ; extra == "dev"
|
|
21
|
+
Requires-Dist: bump-my-version ; extra == "dev"
|
|
21
22
|
Requires-Dist: mkdocs ; extra == "docs"
|
|
22
23
|
Requires-Dist: mkdocs-material ; extra == "docs"
|
|
23
24
|
Requires-Dist: pygments ; extra == "docs"
|
|
@@ -31,6 +31,7 @@ from morecantile.utils import (
|
|
|
31
31
|
_parse_tile_arg,
|
|
32
32
|
bbox_to_feature,
|
|
33
33
|
check_quadkey_support,
|
|
34
|
+
lons_contain_antimeridian,
|
|
34
35
|
meters_per_unit,
|
|
35
36
|
point_in_bbox,
|
|
36
37
|
to_rasterio_crs,
|
|
@@ -660,6 +661,7 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
660
661
|
ordered_axes: Optional[List[str]] = None,
|
|
661
662
|
geographic_crs: pyproj.CRS = WGS84_CRS,
|
|
662
663
|
screen_pixel_size: float = 0.28e-3,
|
|
664
|
+
decimation_base: int = 2,
|
|
663
665
|
**kwargs: Any,
|
|
664
666
|
):
|
|
665
667
|
"""
|
|
@@ -692,8 +694,12 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
692
694
|
Tile Matrix Set identifier
|
|
693
695
|
geographic_crs: pyproj.CRS
|
|
694
696
|
Geographic (lat,lon) coordinate reference system (default is EPSG:4326)
|
|
697
|
+
ordered_axes: list of str, optional
|
|
698
|
+
Override Axis order (e.g `["N", "S"]`) else default to CRS's metadata
|
|
695
699
|
screen_pixel_size: float, optional
|
|
696
700
|
Rendering pixel size. 0.28 mm was the actual pixel size of a common display from 2005 and considered as standard by OGC.
|
|
701
|
+
decimation_base: int, optional
|
|
702
|
+
How tiles are divided at each zoom level (default is 2). Must be greater than 1.
|
|
697
703
|
kwargs: Any
|
|
698
704
|
Attributes to forward to the TileMatrixSet
|
|
699
705
|
|
|
@@ -713,6 +719,11 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
713
719
|
transform = pyproj.Transformer.from_crs(extent_crs, crs, always_xy=True)
|
|
714
720
|
extent = transform.transform_bounds(*extent, densify_pts=21)
|
|
715
721
|
|
|
722
|
+
if decimation_base <= 1:
|
|
723
|
+
raise ValueError(
|
|
724
|
+
"Custom TileMatrixSet requires a decimation base that is greater than 1."
|
|
725
|
+
)
|
|
726
|
+
|
|
716
727
|
bbox = BoundingBox(*extent)
|
|
717
728
|
x_origin = bbox.left if not is_inverted else bbox.top
|
|
718
729
|
y_origin = bbox.top if not is_inverted else bbox.left
|
|
@@ -723,8 +734,10 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
723
734
|
tile_matrices: List[TileMatrix] = []
|
|
724
735
|
for zoom in range(minzoom, maxzoom + 1):
|
|
725
736
|
res = max(
|
|
726
|
-
width / (tile_width * matrix_scale[0]) /
|
|
727
|
-
height
|
|
737
|
+
width / (tile_width * matrix_scale[0]) / float(decimation_base) ** zoom,
|
|
738
|
+
height
|
|
739
|
+
/ (tile_height * matrix_scale[1])
|
|
740
|
+
/ float(decimation_base) ** zoom,
|
|
728
741
|
)
|
|
729
742
|
tile_matrices.append(
|
|
730
743
|
TileMatrix(
|
|
@@ -735,8 +748,8 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
735
748
|
"pointOfOrigin": [x_origin, y_origin],
|
|
736
749
|
"tileWidth": tile_width,
|
|
737
750
|
"tileHeight": tile_height,
|
|
738
|
-
"matrixWidth": matrix_scale[0] *
|
|
739
|
-
"matrixHeight": matrix_scale[1] *
|
|
751
|
+
"matrixWidth": matrix_scale[0] * decimation_base**zoom,
|
|
752
|
+
"matrixHeight": matrix_scale[1] * decimation_base**zoom,
|
|
740
753
|
}
|
|
741
754
|
)
|
|
742
755
|
)
|
|
@@ -1240,9 +1253,11 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
1240
1253
|
|
|
1241
1254
|
for w, s, e, n in bboxes:
|
|
1242
1255
|
# Clamp bounding values.
|
|
1243
|
-
|
|
1256
|
+
ws_contain_180th = lons_contain_antimeridian(w, self.bbox.left)
|
|
1257
|
+
es_contain_180th = lons_contain_antimeridian(e, self.bbox.right)
|
|
1258
|
+
w = min(self.bbox.left, w) if ws_contain_180th else max(self.bbox.left, w)
|
|
1244
1259
|
s = max(self.bbox.bottom, s)
|
|
1245
|
-
e = min(self.bbox.right, e)
|
|
1260
|
+
e = max(self.bbox.right, e) if es_contain_180th else min(self.bbox.right, e)
|
|
1246
1261
|
n = min(self.bbox.top, n)
|
|
1247
1262
|
|
|
1248
1263
|
for z in zooms:
|
|
@@ -40,6 +40,30 @@ def _parse_tile_arg(*args) -> Tile:
|
|
|
40
40
|
)
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
def lons_contain_antimeridian(lon1: float, lon2: float) -> bool:
|
|
44
|
+
"""
|
|
45
|
+
Check if the antimeridian (180th meridian) is between two longitude points
|
|
46
|
+
|
|
47
|
+
Parameters
|
|
48
|
+
----------
|
|
49
|
+
lon1: float
|
|
50
|
+
The first longitude.
|
|
51
|
+
lon2: float
|
|
52
|
+
The second longitude
|
|
53
|
+
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
A bool representing whether two longs contain the 180th meridian.
|
|
57
|
+
"""
|
|
58
|
+
lon1_clipped = max(-180.0, min(lon1, 180))
|
|
59
|
+
lon2_clipped = max(-180.0, min(lon2, 180))
|
|
60
|
+
lon1_converted = (lon1_clipped + 360) % 360
|
|
61
|
+
lon2_converted = (lon2_clipped + 360) % 360
|
|
62
|
+
ws = [lon1_converted, lon2_converted]
|
|
63
|
+
sorted(ws)
|
|
64
|
+
return ws[0] < 180 < ws[1]
|
|
65
|
+
|
|
66
|
+
|
|
43
67
|
def meters_per_unit(crs: CRS) -> float:
|
|
44
68
|
"""
|
|
45
69
|
Coefficient to convert the coordinate reference system (CRS)
|
|
@@ -37,6 +37,7 @@ test = [
|
|
|
37
37
|
]
|
|
38
38
|
dev = [
|
|
39
39
|
"pre-commit",
|
|
40
|
+
"bump-my-version",
|
|
40
41
|
]
|
|
41
42
|
docs = [
|
|
42
43
|
"mkdocs",
|
|
@@ -110,3 +111,18 @@ ignore = [
|
|
|
110
111
|
filterwarnings = [
|
|
111
112
|
"ignore:You will likely lose important projection*:UserWarning",
|
|
112
113
|
]
|
|
114
|
+
|
|
115
|
+
[tool.bumpversion]
|
|
116
|
+
current_version = "5.3.1"
|
|
117
|
+
|
|
118
|
+
search = "{current_version}"
|
|
119
|
+
replace = "{new_version}"
|
|
120
|
+
regex = false
|
|
121
|
+
tag = true
|
|
122
|
+
commit = true
|
|
123
|
+
tag_name = "{new_version}"
|
|
124
|
+
|
|
125
|
+
[[tool.bumpversion.files]]
|
|
126
|
+
filename = "morecantile/__init__.py"
|
|
127
|
+
search = '__version__ = "{current_version}"'
|
|
128
|
+
replace = '__version__ = "{new_version}"'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|