morecantile 5.4.2__py3-none-any.whl → 6.1.0__py3-none-any.whl
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/__init__.py +1 -1
- morecantile/commons.py +4 -4
- morecantile/models.py +31 -21
- {morecantile-5.4.2.dist-info → morecantile-6.1.0.dist-info}/METADATA +8 -3
- {morecantile-5.4.2.dist-info → morecantile-6.1.0.dist-info}/RECORD +8 -8
- {morecantile-5.4.2.dist-info → morecantile-6.1.0.dist-info}/LICENSE +0 -0
- {morecantile-5.4.2.dist-info → morecantile-6.1.0.dist-info}/WHEEL +0 -0
- {morecantile-5.4.2.dist-info → morecantile-6.1.0.dist-info}/entry_points.txt +0 -0
morecantile/__init__.py
CHANGED
morecantile/commons.py
CHANGED
|
@@ -7,10 +7,10 @@ class BoundingBox(NamedTuple):
|
|
|
7
7
|
"""A xmin,ymin,xmax,ymax coordinates tuple.
|
|
8
8
|
|
|
9
9
|
Args:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
left (number): min horizontal coordinate.
|
|
11
|
+
bottom (number):min vertical coordinate.
|
|
12
|
+
right (number): max horizontal coordinate.
|
|
13
|
+
top (number): max vertical coordinate.
|
|
14
14
|
|
|
15
15
|
Examples:
|
|
16
16
|
>>> BoundingBox(-180.0, -90.0, 180.0, 90.0)
|
morecantile/models.py
CHANGED
|
@@ -40,7 +40,6 @@ from morecantile.utils import (
|
|
|
40
40
|
NumType = Union[float, int]
|
|
41
41
|
BoundsType = Tuple[NumType, NumType]
|
|
42
42
|
LL_EPSILON = 1e-11
|
|
43
|
-
WGS84_CRS = pyproj.CRS.from_epsg(4326)
|
|
44
43
|
axesInfo = Annotated[List[str], Field(min_length=2, max_length=2)]
|
|
45
44
|
|
|
46
45
|
|
|
@@ -486,24 +485,25 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
486
485
|
]
|
|
487
486
|
|
|
488
487
|
# Private attributes
|
|
489
|
-
_geographic_crs: pyproj.CRS = PrivateAttr(default=WGS84_CRS)
|
|
490
488
|
_to_geographic: pyproj.Transformer = PrivateAttr()
|
|
491
489
|
_from_geographic: pyproj.Transformer = PrivateAttr()
|
|
492
490
|
|
|
491
|
+
_tile_matrices_idx: Dict[int, int] = PrivateAttr()
|
|
492
|
+
|
|
493
493
|
def __init__(self, **data):
|
|
494
494
|
"""Set private attributes."""
|
|
495
495
|
super().__init__(**data)
|
|
496
496
|
|
|
497
|
-
self.
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
self._tile_matrices_idx = {
|
|
498
|
+
int(mat.id): idx for idx, mat in enumerate(self.tileMatrices)
|
|
499
|
+
}
|
|
500
500
|
|
|
501
501
|
try:
|
|
502
502
|
self._to_geographic = pyproj.Transformer.from_crs(
|
|
503
|
-
self.crs._pyproj_crs, self.
|
|
503
|
+
self.crs._pyproj_crs, self.crs._pyproj_crs.geodetic_crs, always_xy=True
|
|
504
504
|
)
|
|
505
505
|
self._from_geographic = pyproj.Transformer.from_crs(
|
|
506
|
-
self.
|
|
506
|
+
self.crs._pyproj_crs.geodetic_crs, self.crs._pyproj_crs, always_xy=True
|
|
507
507
|
)
|
|
508
508
|
except ProjError:
|
|
509
509
|
warnings.warn(
|
|
@@ -555,7 +555,7 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
555
555
|
@cached_property
|
|
556
556
|
def geographic_crs(self) -> pyproj.CRS:
|
|
557
557
|
"""Return the TMS's geographic CRS."""
|
|
558
|
-
return self.
|
|
558
|
+
return self.crs._pyproj_crs.geodetic_crs
|
|
559
559
|
|
|
560
560
|
@cached_property
|
|
561
561
|
def rasterio_crs(self):
|
|
@@ -565,7 +565,7 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
565
565
|
@cached_property
|
|
566
566
|
def rasterio_geographic_crs(self):
|
|
567
567
|
"""Return the geographic CRS as a rasterio CRS."""
|
|
568
|
-
return to_rasterio_crs(self.
|
|
568
|
+
return to_rasterio_crs(self.crs._pyproj_crs.geodetic_crs)
|
|
569
569
|
|
|
570
570
|
@property
|
|
571
571
|
def minzoom(self) -> int:
|
|
@@ -656,7 +656,6 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
656
656
|
title: Optional[str] = None,
|
|
657
657
|
id: Optional[str] = None,
|
|
658
658
|
ordered_axes: Optional[List[str]] = None,
|
|
659
|
-
geographic_crs: pyproj.CRS = WGS84_CRS,
|
|
660
659
|
screen_pixel_size: float = 0.28e-3,
|
|
661
660
|
decimation_base: int = 2,
|
|
662
661
|
**kwargs: Any,
|
|
@@ -689,8 +688,6 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
689
688
|
Tile Matrix Set title
|
|
690
689
|
id: str, optional
|
|
691
690
|
Tile Matrix Set identifier
|
|
692
|
-
geographic_crs: pyproj.CRS
|
|
693
|
-
Geographic (lat,lon) coordinate reference system (default is EPSG:4326)
|
|
694
691
|
ordered_axes: list of str, optional
|
|
695
692
|
Override Axis order (e.g `["N", "S"]`) else default to CRS's metadata
|
|
696
693
|
screen_pixel_size: float, optional
|
|
@@ -769,15 +766,13 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
769
766
|
tileMatrices=tile_matrices,
|
|
770
767
|
id=id,
|
|
771
768
|
title=title,
|
|
772
|
-
_geographic_crs=geographic_crs,
|
|
773
769
|
**kwargs,
|
|
774
770
|
)
|
|
775
771
|
|
|
776
772
|
def matrix(self, zoom: int) -> TileMatrix:
|
|
777
773
|
"""Return the TileMatrix for a specific zoom."""
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
return m
|
|
774
|
+
if (idx := self._tile_matrices_idx.get(zoom, None)) is not None:
|
|
775
|
+
return self.tileMatrices[idx]
|
|
781
776
|
|
|
782
777
|
#######################################################################
|
|
783
778
|
# If user wants a deeper matrix we calculate it
|
|
@@ -1103,8 +1098,23 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
1103
1098
|
"""
|
|
1104
1099
|
t = _parse_tile_arg(*tile)
|
|
1105
1100
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1101
|
+
matrix = self.matrix(t.z)
|
|
1102
|
+
origin_x, origin_y = self._matrix_origin(matrix)
|
|
1103
|
+
|
|
1104
|
+
cf = (
|
|
1105
|
+
matrix.get_coalesce_factor(t.y)
|
|
1106
|
+
if matrix.variableMatrixWidths is not None
|
|
1107
|
+
else 1
|
|
1108
|
+
)
|
|
1109
|
+
|
|
1110
|
+
left = origin_x + math.floor(t.x / cf) * matrix.cellSize * cf * matrix.tileWidth
|
|
1111
|
+
top = origin_y - t.y * matrix.cellSize * matrix.tileHeight
|
|
1112
|
+
right = (
|
|
1113
|
+
origin_x
|
|
1114
|
+
+ (math.floor(t.x / cf) + 1) * matrix.cellSize * cf * matrix.tileWidth
|
|
1115
|
+
)
|
|
1116
|
+
bottom = origin_y - (t.y + 1) * matrix.cellSize * matrix.tileHeight
|
|
1117
|
+
|
|
1108
1118
|
return BoundingBox(left, bottom, right, top)
|
|
1109
1119
|
|
|
1110
1120
|
def ul(self, *tile: Tile) -> Coords:
|
|
@@ -1156,10 +1166,10 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
|
|
|
1156
1166
|
BoundingBox: The bounding box of the input tile.
|
|
1157
1167
|
|
|
1158
1168
|
"""
|
|
1159
|
-
|
|
1169
|
+
_left, _bottom, _right, _top = self.xy_bounds(*tile)
|
|
1170
|
+
left, top = self.lnglat(_left, _top)
|
|
1171
|
+
right, bottom = self.lnglat(_right, _bottom)
|
|
1160
1172
|
|
|
1161
|
-
left, top = self.ul(t)
|
|
1162
|
-
right, bottom = self.lr(t)
|
|
1163
1173
|
return BoundingBox(left, bottom, right, top)
|
|
1164
1174
|
|
|
1165
1175
|
@property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: morecantile
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.1.0
|
|
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,10 +18,14 @@ Classifier: Topic :: Scientific/Engineering :: GIS
|
|
|
18
18
|
Requires-Dist: attrs
|
|
19
19
|
Requires-Dist: pyproj~=3.1
|
|
20
20
|
Requires-Dist: pydantic~=2.0
|
|
21
|
+
Requires-Dist: pytest ; extra == "benchmark"
|
|
22
|
+
Requires-Dist: pytest-benchmark ; extra == "benchmark"
|
|
21
23
|
Requires-Dist: pre-commit ; extra == "dev"
|
|
22
24
|
Requires-Dist: bump-my-version ; extra == "dev"
|
|
23
|
-
Requires-Dist: mkdocs ; extra == "docs"
|
|
24
|
-
Requires-Dist: mkdocs-material ; extra == "docs"
|
|
25
|
+
Requires-Dist: mkdocs>=1.4.3 ; extra == "docs"
|
|
26
|
+
Requires-Dist: mkdocs-material[imaging]>=9.5 ; extra == "docs"
|
|
27
|
+
Requires-Dist: griffe-inherited-docstrings>=1.0.0 ; extra == "docs"
|
|
28
|
+
Requires-Dist: mkdocstrings[python]>=0.25.1 ; extra == "docs"
|
|
25
29
|
Requires-Dist: pygments ; extra == "docs"
|
|
26
30
|
Requires-Dist: rasterio>=1.2.1 ; extra == "rasterio"
|
|
27
31
|
Requires-Dist: mercantile ; extra == "test"
|
|
@@ -30,6 +34,7 @@ Requires-Dist: pytest-cov ; extra == "test"
|
|
|
30
34
|
Requires-Dist: rasterio>=1.2.1 ; extra == "test"
|
|
31
35
|
Project-URL: Documentation, https://developmentseed.org/morecantile/
|
|
32
36
|
Project-URL: Source, https://github.com/developmentseed/morecantile
|
|
37
|
+
Provides-Extra: benchmark
|
|
33
38
|
Provides-Extra: dev
|
|
34
39
|
Provides-Extra: docs
|
|
35
40
|
Provides-Extra: rasterio
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
morecantile/__init__.py,sha256=
|
|
2
|
-
morecantile/commons.py,sha256=
|
|
1
|
+
morecantile/__init__.py,sha256=Ge_Q-KuZkTJKwAfz3oz8LHNYTPlGZpU-OHRpTtm4XjY,436
|
|
2
|
+
morecantile/commons.py,sha256=iHElysLSMu-zb3h1G1-AJnQrZ6y-2GseZkoBkOuzcZ8,1031
|
|
3
3
|
morecantile/defaults.py,sha256=9lvHmZ9WM_J5uNCS9VWEy8O5_x2dA2Spvk4H5aHv6UQ,1804
|
|
4
4
|
morecantile/errors.py,sha256=rhtdpNglfEz5nC8I-BJKUr_gkOwAPwVi1vhLFJ2StYw,907
|
|
5
|
-
morecantile/models.py,sha256=
|
|
5
|
+
morecantile/models.py,sha256=17p2BlpYRGxW61WK4fwh6GU68Gffa9ovGWghk2cQzaI,51856
|
|
6
6
|
morecantile/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
morecantile/utils.py,sha256=-JUTcrwhT_TEWAPWV8YQBQJoYU2HfVkqQEJaggtnKJg,4020
|
|
8
8
|
morecantile/data/CDB1GlobalGrid.json,sha256=VDc2ukAWtTQeCdOG8YMqsGO-D7eSzSCN1TEaBn2qLZI,36115
|
|
@@ -21,8 +21,8 @@ morecantile/data/WorldCRS84Quad.json,sha256=l0Wf2faYwzRwO0mG-Tea1Vydpi7V1Oel5L9l
|
|
|
21
21
|
morecantile/data/WorldMercatorWGS84Quad.json,sha256=JaqoBSu5qVJmL-J7oSVU1etP2OPWx_aVaTc68dGX0Ec,7001
|
|
22
22
|
morecantile/scripts/__init__.py,sha256=-CJncfgWDnSZ8au-SJtgX-OFgCddlf7___d91qQcqQM,23
|
|
23
23
|
morecantile/scripts/cli.py,sha256=TOc1RjLXuTzKs2FNNHQ3eCiGqiBoDFA4fKWpOAuY12s,17364
|
|
24
|
-
morecantile-
|
|
25
|
-
morecantile-
|
|
26
|
-
morecantile-
|
|
27
|
-
morecantile-
|
|
28
|
-
morecantile-
|
|
24
|
+
morecantile-6.1.0.dist-info/entry_points.txt,sha256=keoXuYgnX-mdrGWwXIHqEkSZjQK_iAmtmdrtZ3sCT24,59
|
|
25
|
+
morecantile-6.1.0.dist-info/LICENSE,sha256=18IxFIta7rF_RcVSIgLUUd_alyfQ9bGoZKQm5vOarGU,1073
|
|
26
|
+
morecantile-6.1.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
27
|
+
morecantile-6.1.0.dist-info/METADATA,sha256=FuP9VVcbql1Tn47NSTrmD_cOL8T2rBLqvp2pc0mYges,7266
|
|
28
|
+
morecantile-6.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|