morecantile 3.2.5__py3-none-any.whl → 4.0.0a0__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/data/CanadianNAD83_LCC.json +269 -357
- morecantile/data/EuropeanETRS89_LAEAQuad.json +73 -248
- morecantile/data/LINZAntarticaMapTilegrid.json +64 -61
- morecantile/data/NZTM2000Quad.json +294 -303
- morecantile/data/UPSAntarcticWGS84Quad.json +259 -344
- morecantile/data/UPSArcticWGS84Quad.json +259 -344
- morecantile/data/UTM31WGS84Quad.json +249 -331
- morecantile/data/WGS1984Quad.json +324 -254
- morecantile/data/WebMercatorQuad.json +260 -345
- morecantile/data/WorldCRS84Quad.json +249 -254
- morecantile/data/WorldMercatorWGS84Quad.json +260 -345
- morecantile/defaults.py +11 -13
- morecantile/errors.py +4 -0
- morecantile/models.py +299 -186
- morecantile/scripts/cli.py +5 -5
- morecantile/utils.py +17 -5
- {morecantile-3.2.5.dist-info → morecantile-4.0.0a0.dist-info}/METADATA +60 -27
- morecantile-4.0.0a0.dist-info/RECORD +26 -0
- {morecantile-3.2.5.dist-info → morecantile-4.0.0a0.dist-info}/WHEEL +1 -1
- morecantile/data/NZTM2000.json +0 -242
- morecantile-3.2.5.dist-info/RECORD +0 -27
- {morecantile-3.2.5.dist-info → morecantile-4.0.0a0.dist-info}/LICENSE +0 -0
- {morecantile-3.2.5.dist-info → morecantile-4.0.0a0.dist-info}/entry_points.txt +0 -0
morecantile/defaults.py
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import os
|
|
4
4
|
import pathlib
|
|
5
5
|
from copy import copy
|
|
6
|
-
from typing import Dict, List,
|
|
6
|
+
from typing import Dict, List, Union
|
|
7
7
|
|
|
8
8
|
import attr
|
|
9
9
|
|
|
10
|
-
from .errors import InvalidIdentifier
|
|
11
|
-
from .models import TileMatrixSet
|
|
10
|
+
from morecantile.errors import InvalidIdentifier
|
|
11
|
+
from morecantile.models import TileMatrixSet
|
|
12
12
|
|
|
13
13
|
morecantile_tms_dir = pathlib.Path(__file__).parent.joinpath("data")
|
|
14
14
|
tms_paths = list(pathlib.Path(morecantile_tms_dir).glob("*.json"))
|
|
@@ -18,7 +18,7 @@ if user_tms_dir:
|
|
|
18
18
|
tms_paths.extend(list(pathlib.Path(user_tms_dir).glob("*.json")))
|
|
19
19
|
|
|
20
20
|
default_tms: Dict[str, Union[TileMatrixSet, pathlib.Path]] = {
|
|
21
|
-
tms.stem: tms for tms in tms_paths
|
|
21
|
+
tms.stem: tms for tms in sorted(tms_paths)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
@@ -34,6 +34,8 @@ class TileMatrixSets:
|
|
|
34
34
|
raise InvalidIdentifier(f"Invalid identifier: {identifier}")
|
|
35
35
|
|
|
36
36
|
tms = self.tms[identifier]
|
|
37
|
+
|
|
38
|
+
# We lazyload the TMS document only when called
|
|
37
39
|
if isinstance(tms, pathlib.Path):
|
|
38
40
|
tms = TileMatrixSet.parse_file(tms)
|
|
39
41
|
self.tms[identifier] = tms
|
|
@@ -46,19 +48,15 @@ class TileMatrixSets:
|
|
|
46
48
|
|
|
47
49
|
def register(
|
|
48
50
|
self,
|
|
49
|
-
custom_tms:
|
|
51
|
+
custom_tms: Dict[str, TileMatrixSet],
|
|
50
52
|
overwrite: bool = False,
|
|
51
53
|
) -> "TileMatrixSets":
|
|
52
54
|
"""Register TileMatrixSet(s)."""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
for tms in custom_tms:
|
|
57
|
-
if tms.identifier in self.tms and not overwrite:
|
|
58
|
-
raise Exception(f"{tms.identifier} is already a registered TMS.")
|
|
55
|
+
for identifier in custom_tms.keys():
|
|
56
|
+
if identifier in self.tms and not overwrite:
|
|
57
|
+
raise Exception(f"{identifier} is already a registered TMS.")
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
return TileMatrixSets({**self.tms, **new_tms})
|
|
59
|
+
return TileMatrixSets({**self.tms, **custom_tms})
|
|
62
60
|
|
|
63
61
|
|
|
64
62
|
tms = TileMatrixSets(copy(default_tms)) # noqa
|