morecantile 6.2.0__tar.gz → 7.0.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.
Files changed (33) hide show
  1. {morecantile-6.2.0 → morecantile-7.0.1}/.gitignore +1 -0
  2. {morecantile-6.2.0 → morecantile-7.0.1}/PKG-INFO +38 -35
  3. {morecantile-6.2.0 → morecantile-7.0.1}/README.md +4 -4
  4. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/__init__.py +1 -1
  5. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/NZTM2000Quad.json +0 -1
  6. morecantile-7.0.1/morecantile/data/WebMercatorQuad.json +363 -0
  7. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/defaults.py +15 -16
  8. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/models.py +280 -171
  9. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/scripts/cli.py +19 -5
  10. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/utils.py +24 -3
  11. {morecantile-6.2.0 → morecantile-7.0.1}/pyproject.toml +26 -28
  12. morecantile-6.2.0/.pre-commit-config.yaml +0 -27
  13. morecantile-6.2.0/benchmarks/README.md +0 -63
  14. morecantile-6.2.0/benchmarks/benchmarks.py +0 -96
  15. morecantile-6.2.0/benchmarks/requirements.txt +0 -6
  16. morecantile-6.2.0/morecantile/data/WebMercatorQuad.json +0 -261
  17. {morecantile-6.2.0 → morecantile-7.0.1}/LICENSE +0 -0
  18. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/commons.py +0 -0
  19. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/CDB1GlobalGrid.json +0 -0
  20. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/CanadianNAD83_LCC.json +0 -0
  21. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/EuropeanETRS89_LAEAQuad.json +0 -0
  22. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/GNOSISGlobalGrid.json +0 -0
  23. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/LINZAntarticaMapTilegrid.json +0 -0
  24. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/README.md +0 -0
  25. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/UPSAntarcticWGS84Quad.json +0 -0
  26. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/UPSArcticWGS84Quad.json +0 -0
  27. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/UTM31WGS84Quad.json +0 -0
  28. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/WGS1984Quad.json +0 -0
  29. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/WorldCRS84Quad.json +0 -0
  30. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/data/WorldMercatorWGS84Quad.json +0 -0
  31. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/errors.py +0 -0
  32. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/py.typed +0 -0
  33. {morecantile-6.2.0 → morecantile-7.0.1}/morecantile/scripts/__init__.py +0 -0
@@ -134,3 +134,4 @@ dmypy.json
134
134
  # VSCode
135
135
  .vscode
136
136
  .vscode/
137
+ .notebooks/
@@ -1,45 +1,49 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: morecantile
3
- Version: 6.2.0
3
+ Version: 7.0.1
4
4
  Summary: Construct and use map tile grids (a.k.a TileMatrixSet / TMS).
5
- Keywords: GIS,TMS,TileMatrixSet,Map Tile
5
+ Project-URL: Source, https://github.com/developmentseed/morecantile
6
+ Project-URL: Documentation, https://developmentseed.org/morecantile/
6
7
  Author-email: Vincent Sarago <vincent@developmentseed.com>
7
- Requires-Python: >=3.8
8
- Description-Content-Type: text/markdown
8
+ License: MIT License
9
+
10
+ Copyright (c) 2020 Development Seed
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: GIS,Map Tile,TMS,TileMatrixSet
9
31
  Classifier: Intended Audience :: Information Technology
10
32
  Classifier: Intended Audience :: Science/Research
11
- Classifier: License :: OSI Approved :: BSD License
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
33
+ Classifier: License :: OSI Approved :: MIT License
15
34
  Classifier: Programming Language :: Python :: 3.11
16
35
  Classifier: Programming Language :: Python :: 3.12
17
36
  Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Programming Language :: Python :: 3.14
18
38
  Classifier: Topic :: Scientific/Engineering :: GIS
39
+ Requires-Python: >=3.11
19
40
  Requires-Dist: attrs
20
- Requires-Dist: pyproj>=3.1,<4.0
41
+ Requires-Dist: click
21
42
  Requires-Dist: pydantic~=2.0
22
- Requires-Dist: pytest ; extra == "benchmark"
23
- Requires-Dist: pytest-benchmark ; extra == "benchmark"
24
- Requires-Dist: pre-commit ; extra == "dev"
25
- Requires-Dist: bump-my-version ; extra == "dev"
26
- Requires-Dist: mkdocs>=1.4.3 ; extra == "docs"
27
- Requires-Dist: mkdocs-material[imaging]>=9.5 ; extra == "docs"
28
- Requires-Dist: griffe-inherited-docstrings>=1.0.0 ; extra == "docs"
29
- Requires-Dist: mkdocstrings[python]>=0.25.1 ; extra == "docs"
30
- Requires-Dist: pygments ; extra == "docs"
31
- Requires-Dist: rasterio>=1.2.1 ; extra == "rasterio"
32
- Requires-Dist: mercantile ; extra == "test"
33
- Requires-Dist: pytest ; extra == "test"
34
- Requires-Dist: pytest-cov ; extra == "test"
35
- Requires-Dist: rasterio>=1.2.1 ; extra == "test"
36
- Project-URL: Documentation, https://developmentseed.org/morecantile/
37
- Project-URL: Source, https://github.com/developmentseed/morecantile
38
- Provides-Extra: benchmark
39
- Provides-Extra: dev
40
- Provides-Extra: docs
43
+ Requires-Dist: pyproj<4.0,>=3.1
41
44
  Provides-Extra: rasterio
42
- Provides-Extra: test
45
+ Requires-Dist: rasterio>=1.2.1; extra == 'rasterio'
46
+ Description-Content-Type: text/markdown
43
47
 
44
48
  # Morecantile
45
49
 
@@ -87,12 +91,12 @@ Morecantile is like [mercantile](https://github.com/mapbox/mercantile) (the best
87
91
  ## Install
88
92
 
89
93
  ```bash
90
- $ python -m pip install -U pip
91
- $ python -m pip install morecantile
94
+ python -m pip install -U pip
95
+ python -m pip install morecantile
92
96
 
93
97
  # Or install from source:
94
- $ python -m pip install -U pip
95
- $ python -m pip install git+https://github.com/developmentseed/morecantile.git
98
+ python -m pip install -U pip
99
+ python -m pip install git+https://github.com/developmentseed/morecantile.git
96
100
  ```
97
101
 
98
102
  ## Usage
@@ -178,4 +182,3 @@ See [LICENSE](https://github.com/developmentseed/morecantile/blob/main/LICENSE)
178
182
  ## Authors
179
183
 
180
184
  Created by [Development Seed](<http://developmentseed.org>)
181
-
@@ -44,12 +44,12 @@ Morecantile is like [mercantile](https://github.com/mapbox/mercantile) (the best
44
44
  ## Install
45
45
 
46
46
  ```bash
47
- $ python -m pip install -U pip
48
- $ python -m pip install morecantile
47
+ python -m pip install -U pip
48
+ python -m pip install morecantile
49
49
 
50
50
  # Or install from source:
51
- $ python -m pip install -U pip
52
- $ python -m pip install git+https://github.com/developmentseed/morecantile.git
51
+ python -m pip install -U pip
52
+ python -m pip install git+https://github.com/developmentseed/morecantile.git
53
53
  ```
54
54
 
55
55
  ## Usage
@@ -8,7 +8,7 @@ Refs:
8
8
 
9
9
  """
10
10
 
11
- __version__ = "6.2.0"
11
+ __version__ = "7.0.1"
12
12
 
13
13
  from .commons import BoundingBox, Coords, Tile # noqa
14
14
  from .defaults import TileMatrixSets, tms # noqa
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "title": "LINZ NZTM2000Quad Map Tile Grid",
3
- "abstract": "See https://github.com/linz/NZTM2000TileMatrixSet",
4
3
  "id": "NZTM2000Quad",
5
4
  "crs": "urn:ogc:def:crs:EPSG::2193",
6
5
  "orderedAxes": [
@@ -0,0 +1,363 @@
1
+ {
2
+ "id": "WebMercatorQuad",
3
+ "title": "Google Maps Compatible for the World",
4
+ "uri": "http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad",
5
+ "crs": "http://www.opengis.net/def/crs/EPSG/0/3857",
6
+ "orderedAxes": [
7
+ "X",
8
+ "Y"
9
+ ],
10
+ "wellKnownScaleSet": "http://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
11
+ "tileMatrices": [
12
+ {
13
+ "id": "0",
14
+ "scaleDenominator": 559082264.0287178,
15
+ "cellSize": 156543.03392804097,
16
+ "cornerOfOrigin": "topLeft",
17
+ "pointOfOrigin": [
18
+ -20037508.342789244,
19
+ 20037508.342789244
20
+ ],
21
+ "tileWidth": 256,
22
+ "tileHeight": 256,
23
+ "matrixWidth": 1,
24
+ "matrixHeight": 1
25
+ },
26
+ {
27
+ "id": "1",
28
+ "scaleDenominator": 279541132.0143589,
29
+ "cellSize": 78271.51696402048,
30
+ "cornerOfOrigin": "topLeft",
31
+ "pointOfOrigin": [
32
+ -20037508.342789244,
33
+ 20037508.342789244
34
+ ],
35
+ "tileWidth": 256,
36
+ "tileHeight": 256,
37
+ "matrixWidth": 2,
38
+ "matrixHeight": 2
39
+ },
40
+ {
41
+ "id": "2",
42
+ "scaleDenominator": 139770566.00717944,
43
+ "cellSize": 39135.75848201024,
44
+ "cornerOfOrigin": "topLeft",
45
+ "pointOfOrigin": [
46
+ -20037508.342789244,
47
+ 20037508.342789244
48
+ ],
49
+ "tileWidth": 256,
50
+ "tileHeight": 256,
51
+ "matrixWidth": 4,
52
+ "matrixHeight": 4
53
+ },
54
+ {
55
+ "id": "3",
56
+ "scaleDenominator": 69885283.00358972,
57
+ "cellSize": 19567.87924100512,
58
+ "cornerOfOrigin": "topLeft",
59
+ "pointOfOrigin": [
60
+ -20037508.342789244,
61
+ 20037508.342789244
62
+ ],
63
+ "tileWidth": 256,
64
+ "tileHeight": 256,
65
+ "matrixWidth": 8,
66
+ "matrixHeight": 8
67
+ },
68
+ {
69
+ "id": "4",
70
+ "scaleDenominator": 34942641.50179486,
71
+ "cellSize": 9783.93962050256,
72
+ "cornerOfOrigin": "topLeft",
73
+ "pointOfOrigin": [
74
+ -20037508.342789244,
75
+ 20037508.342789244
76
+ ],
77
+ "tileWidth": 256,
78
+ "tileHeight": 256,
79
+ "matrixWidth": 16,
80
+ "matrixHeight": 16
81
+ },
82
+ {
83
+ "id": "5",
84
+ "scaleDenominator": 17471320.75089743,
85
+ "cellSize": 4891.96981025128,
86
+ "cornerOfOrigin": "topLeft",
87
+ "pointOfOrigin": [
88
+ -20037508.342789244,
89
+ 20037508.342789244
90
+ ],
91
+ "tileWidth": 256,
92
+ "tileHeight": 256,
93
+ "matrixWidth": 32,
94
+ "matrixHeight": 32
95
+ },
96
+ {
97
+ "id": "6",
98
+ "scaleDenominator": 8735660.375448715,
99
+ "cellSize": 2445.98490512564,
100
+ "cornerOfOrigin": "topLeft",
101
+ "pointOfOrigin": [
102
+ -20037508.342789244,
103
+ 20037508.342789244
104
+ ],
105
+ "tileWidth": 256,
106
+ "tileHeight": 256,
107
+ "matrixWidth": 64,
108
+ "matrixHeight": 64
109
+ },
110
+ {
111
+ "id": "7",
112
+ "scaleDenominator": 4367830.1877243575,
113
+ "cellSize": 1222.99245256282,
114
+ "cornerOfOrigin": "topLeft",
115
+ "pointOfOrigin": [
116
+ -20037508.342789244,
117
+ 20037508.342789244
118
+ ],
119
+ "tileWidth": 256,
120
+ "tileHeight": 256,
121
+ "matrixWidth": 128,
122
+ "matrixHeight": 128
123
+ },
124
+ {
125
+ "id": "8",
126
+ "scaleDenominator": 2183915.0938621787,
127
+ "cellSize": 611.49622628141,
128
+ "cornerOfOrigin": "topLeft",
129
+ "pointOfOrigin": [
130
+ -20037508.342789244,
131
+ 20037508.342789244
132
+ ],
133
+ "tileWidth": 256,
134
+ "tileHeight": 256,
135
+ "matrixWidth": 256,
136
+ "matrixHeight": 256
137
+ },
138
+ {
139
+ "id": "9",
140
+ "scaleDenominator": 1091957.5469310894,
141
+ "cellSize": 305.748113140705,
142
+ "cornerOfOrigin": "topLeft",
143
+ "pointOfOrigin": [
144
+ -20037508.342789244,
145
+ 20037508.342789244
146
+ ],
147
+ "tileWidth": 256,
148
+ "tileHeight": 256,
149
+ "matrixWidth": 512,
150
+ "matrixHeight": 512
151
+ },
152
+ {
153
+ "id": "10",
154
+ "scaleDenominator": 545978.7734655447,
155
+ "cellSize": 152.8740565703525,
156
+ "cornerOfOrigin": "topLeft",
157
+ "pointOfOrigin": [
158
+ -20037508.342789244,
159
+ 20037508.342789244
160
+ ],
161
+ "tileWidth": 256,
162
+ "tileHeight": 256,
163
+ "matrixWidth": 1024,
164
+ "matrixHeight": 1024
165
+ },
166
+ {
167
+ "id": "11",
168
+ "scaleDenominator": 272989.38673277234,
169
+ "cellSize": 76.43702828517625,
170
+ "cornerOfOrigin": "topLeft",
171
+ "pointOfOrigin": [
172
+ -20037508.342789244,
173
+ 20037508.342789244
174
+ ],
175
+ "tileWidth": 256,
176
+ "tileHeight": 256,
177
+ "matrixWidth": 2048,
178
+ "matrixHeight": 2048
179
+ },
180
+ {
181
+ "id": "12",
182
+ "scaleDenominator": 136494.69336638617,
183
+ "cellSize": 38.21851414258813,
184
+ "cornerOfOrigin": "topLeft",
185
+ "pointOfOrigin": [
186
+ -20037508.342789244,
187
+ 20037508.342789244
188
+ ],
189
+ "tileWidth": 256,
190
+ "tileHeight": 256,
191
+ "matrixWidth": 4096,
192
+ "matrixHeight": 4096
193
+ },
194
+ {
195
+ "id": "13",
196
+ "scaleDenominator": 68247.34668319309,
197
+ "cellSize": 19.109257071294063,
198
+ "cornerOfOrigin": "topLeft",
199
+ "pointOfOrigin": [
200
+ -20037508.342789244,
201
+ 20037508.342789244
202
+ ],
203
+ "tileWidth": 256,
204
+ "tileHeight": 256,
205
+ "matrixWidth": 8192,
206
+ "matrixHeight": 8192
207
+ },
208
+ {
209
+ "id": "14",
210
+ "scaleDenominator": 34123.67334159654,
211
+ "cellSize": 9.554628535647032,
212
+ "cornerOfOrigin": "topLeft",
213
+ "pointOfOrigin": [
214
+ -20037508.342789244,
215
+ 20037508.342789244
216
+ ],
217
+ "tileWidth": 256,
218
+ "tileHeight": 256,
219
+ "matrixWidth": 16384,
220
+ "matrixHeight": 16384
221
+ },
222
+ {
223
+ "id": "15",
224
+ "scaleDenominator": 17061.83667079827,
225
+ "cellSize": 4.777314267823516,
226
+ "cornerOfOrigin": "topLeft",
227
+ "pointOfOrigin": [
228
+ -20037508.342789244,
229
+ 20037508.342789244
230
+ ],
231
+ "tileWidth": 256,
232
+ "tileHeight": 256,
233
+ "matrixWidth": 32768,
234
+ "matrixHeight": 32768
235
+ },
236
+ {
237
+ "id": "16",
238
+ "scaleDenominator": 8530.918335399136,
239
+ "cellSize": 2.388657133911758,
240
+ "cornerOfOrigin": "topLeft",
241
+ "pointOfOrigin": [
242
+ -20037508.342789244,
243
+ 20037508.342789244
244
+ ],
245
+ "tileWidth": 256,
246
+ "tileHeight": 256,
247
+ "matrixWidth": 65536,
248
+ "matrixHeight": 65536
249
+ },
250
+ {
251
+ "id": "17",
252
+ "scaleDenominator": 4265.459167699568,
253
+ "cellSize": 1.194328566955879,
254
+ "cornerOfOrigin": "topLeft",
255
+ "pointOfOrigin": [
256
+ -20037508.342789244,
257
+ 20037508.342789244
258
+ ],
259
+ "tileWidth": 256,
260
+ "tileHeight": 256,
261
+ "matrixWidth": 131072,
262
+ "matrixHeight": 131072
263
+ },
264
+ {
265
+ "id": "18",
266
+ "scaleDenominator": 2132.729583849784,
267
+ "cellSize": 0.5971642834779395,
268
+ "cornerOfOrigin": "topLeft",
269
+ "pointOfOrigin": [
270
+ -20037508.342789244,
271
+ 20037508.342789244
272
+ ],
273
+ "tileWidth": 256,
274
+ "tileHeight": 256,
275
+ "matrixWidth": 262144,
276
+ "matrixHeight": 262144
277
+ },
278
+ {
279
+ "id": "19",
280
+ "scaleDenominator": 1066.364791924892,
281
+ "cellSize": 0.29858214173896974,
282
+ "cornerOfOrigin": "topLeft",
283
+ "pointOfOrigin": [
284
+ -20037508.342789244,
285
+ 20037508.342789244
286
+ ],
287
+ "tileWidth": 256,
288
+ "tileHeight": 256,
289
+ "matrixWidth": 524288,
290
+ "matrixHeight": 524288
291
+ },
292
+ {
293
+ "id": "20",
294
+ "scaleDenominator": 533.182395962446,
295
+ "cellSize": 0.14929107086948487,
296
+ "cornerOfOrigin": "topLeft",
297
+ "pointOfOrigin": [
298
+ -20037508.342789244,
299
+ 20037508.342789244
300
+ ],
301
+ "tileWidth": 256,
302
+ "tileHeight": 256,
303
+ "matrixWidth": 1048576,
304
+ "matrixHeight": 1048576
305
+ },
306
+ {
307
+ "id": "21",
308
+ "scaleDenominator": 266.591197981223,
309
+ "cellSize": 0.07464553543474244,
310
+ "cornerOfOrigin": "topLeft",
311
+ "pointOfOrigin": [
312
+ -20037508.342789244,
313
+ 20037508.342789244
314
+ ],
315
+ "tileWidth": 256,
316
+ "tileHeight": 256,
317
+ "matrixWidth": 2097152,
318
+ "matrixHeight": 2097152
319
+ },
320
+ {
321
+ "id": "22",
322
+ "scaleDenominator": 133.2955989906115,
323
+ "cellSize": 0.03732276771737122,
324
+ "cornerOfOrigin": "topLeft",
325
+ "pointOfOrigin": [
326
+ -20037508.342789244,
327
+ 20037508.342789244
328
+ ],
329
+ "tileWidth": 256,
330
+ "tileHeight": 256,
331
+ "matrixWidth": 4194304,
332
+ "matrixHeight": 4194304
333
+ },
334
+ {
335
+ "id": "23",
336
+ "scaleDenominator": 66.64779949530575,
337
+ "cellSize": 0.01866138385868561,
338
+ "cornerOfOrigin": "topLeft",
339
+ "pointOfOrigin": [
340
+ -20037508.342789244,
341
+ 20037508.342789244
342
+ ],
343
+ "tileWidth": 256,
344
+ "tileHeight": 256,
345
+ "matrixWidth": 8388608,
346
+ "matrixHeight": 8388608
347
+ },
348
+ {
349
+ "id": "24",
350
+ "scaleDenominator": 33.323899747652874,
351
+ "cellSize": 0.009330691929342804,
352
+ "cornerOfOrigin": "topLeft",
353
+ "pointOfOrigin": [
354
+ -20037508.342789244,
355
+ 20037508.342789244
356
+ ],
357
+ "tileWidth": 256,
358
+ "tileHeight": 256,
359
+ "matrixWidth": 16777216,
360
+ "matrixHeight": 16777216
361
+ }
362
+ ]
363
+ }
@@ -2,8 +2,7 @@
2
2
 
3
3
  import os
4
4
  import pathlib
5
- from copy import copy
6
- from typing import Dict, List, Union
5
+ from copy import copy, deepcopy
7
6
 
8
7
  import attr
9
8
 
@@ -17,7 +16,7 @@ user_tms_dir = os.environ.get("TILEMATRIXSET_DIRECTORY", None)
17
16
  if user_tms_dir:
18
17
  tms_paths.extend(list(pathlib.Path(user_tms_dir).glob("*.json")))
19
18
 
20
- default_tms: Dict[str, Union[TileMatrixSet, pathlib.Path]] = {
19
+ default_tms: dict[str, TileMatrixSet | pathlib.Path] = {
21
20
  tms.stem: tms for tms in sorted(tms_paths)
22
21
  }
23
22
 
@@ -26,38 +25,38 @@ default_tms: Dict[str, Union[TileMatrixSet, pathlib.Path]] = {
26
25
  class TileMatrixSets:
27
26
  """Default TileMatrixSets holder."""
28
27
 
29
- tms: Dict = attr.ib()
28
+ tilematrixsets: dict = attr.ib()
30
29
 
31
30
  def get(self, identifier: str) -> TileMatrixSet:
32
31
  """Fetch a TMS."""
33
- if identifier not in self.tms:
32
+ if identifier not in self.tilematrixsets:
34
33
  raise InvalidIdentifier(f"Invalid identifier: {identifier}")
35
34
 
36
- tms = self.tms[identifier]
35
+ tilematrix = self.tilematrixsets[identifier]
37
36
 
38
37
  # We lazyload the TMS document only when called
39
- if isinstance(tms, pathlib.Path):
40
- with tms.open() as f:
41
- tms = TileMatrixSet.model_validate_json(f.read())
42
- self.tms[identifier] = tms
38
+ if isinstance(tilematrix, pathlib.Path):
39
+ with tilematrix.open() as f:
40
+ tilematrix = TileMatrixSet.model_validate_json(f.read())
41
+ self.tilematrixsets[identifier] = tilematrix
43
42
 
44
- return tms
43
+ return deepcopy(tilematrix)
45
44
 
46
- def list(self) -> List[str]:
45
+ def list(self) -> list[str]:
47
46
  """List registered TMS."""
48
- return list(self.tms.keys())
47
+ return list(self.tilematrixsets.keys())
49
48
 
50
49
  def register(
51
50
  self,
52
- custom_tms: Dict[str, TileMatrixSet],
51
+ custom_tms: dict[str, TileMatrixSet],
53
52
  overwrite: bool = False,
54
53
  ) -> "TileMatrixSets":
55
54
  """Register TileMatrixSet(s)."""
56
55
  for identifier in custom_tms.keys():
57
- if identifier in self.tms and not overwrite:
56
+ if identifier in self.tilematrixsets and not overwrite:
58
57
  raise InvalidIdentifier(f"{identifier} is already a registered TMS.")
59
58
 
60
- return TileMatrixSets({**self.tms, **custom_tms})
59
+ return TileMatrixSets({**self.tilematrixsets, **custom_tms})
61
60
 
62
61
 
63
62
  tms = TileMatrixSets(copy(default_tms)) # noqa