morecantile 5.3.1__tar.gz → 5.4.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 (29) hide show
  1. {morecantile-5.3.1 → morecantile-5.4.1}/PKG-INFO +2 -1
  2. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/__init__.py +1 -1
  3. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/models.py +4 -7
  4. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/scripts/cli.py +25 -6
  5. {morecantile-5.3.1 → morecantile-5.4.1}/pyproject.toml +2 -1
  6. {morecantile-5.3.1 → morecantile-5.4.1}/.gitignore +0 -0
  7. {morecantile-5.3.1 → morecantile-5.4.1}/.pre-commit-config.yaml +0 -0
  8. {morecantile-5.3.1 → morecantile-5.4.1}/LICENSE +0 -0
  9. {morecantile-5.3.1 → morecantile-5.4.1}/README.md +0 -0
  10. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/commons.py +0 -0
  11. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/CDB1GlobalGrid.json +0 -0
  12. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/CanadianNAD83_LCC.json +0 -0
  13. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/EuropeanETRS89_LAEAQuad.json +0 -0
  14. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/GNOSISGlobalGrid.json +0 -0
  15. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/LINZAntarticaMapTilegrid.json +0 -0
  16. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/NZTM2000Quad.json +0 -0
  17. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/README.md +0 -0
  18. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/UPSAntarcticWGS84Quad.json +0 -0
  19. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/UPSArcticWGS84Quad.json +0 -0
  20. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/UTM31WGS84Quad.json +0 -0
  21. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/WGS1984Quad.json +0 -0
  22. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/WebMercatorQuad.json +0 -0
  23. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/WorldCRS84Quad.json +0 -0
  24. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/data/WorldMercatorWGS84Quad.json +0 -0
  25. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/defaults.py +0 -0
  26. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/errors.py +0 -0
  27. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/py.typed +0 -0
  28. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/scripts/__init__.py +0 -0
  29. {morecantile-5.3.1 → morecantile-5.4.1}/morecantile/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: morecantile
3
- Version: 5.3.1
3
+ Version: 5.4.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>
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.8
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
16
17
  Classifier: Topic :: Scientific/Engineering :: GIS
17
18
  Requires-Dist: attrs
18
19
  Requires-Dist: pyproj~=3.1
@@ -8,7 +8,7 @@ Refs:
8
8
 
9
9
  """
10
10
 
11
- __version__ = "5.3.1"
11
+ __version__ = "5.4.1"
12
12
 
13
13
  from .commons import BoundingBox, Coords, Tile # noqa
14
14
  from .defaults import TileMatrixSets, tms # noqa
@@ -1,7 +1,6 @@
1
1
  """Pydantic modules for OGC TileMatrixSets (https://www.ogc.org/standards/tms)"""
2
2
 
3
3
  import math
4
- import sys
5
4
  import warnings
6
5
  from functools import cached_property
7
6
  from typing import Any, Dict, Iterator, List, Literal, Optional, Sequence, Tuple, Union
@@ -18,6 +17,7 @@ from pydantic import (
18
17
  model_validator,
19
18
  )
20
19
  from pyproj.exceptions import CRSError, ProjError
20
+ from typing_extensions import Annotated
21
21
 
22
22
  from morecantile.commons import BoundingBox, Coords, Tile
23
23
  from morecantile.errors import (
@@ -37,11 +37,6 @@ from morecantile.utils import (
37
37
  to_rasterio_crs,
38
38
  )
39
39
 
40
- if sys.version_info >= (3, 9):
41
- from typing import Annotated # pylint: disable=no-name-in-module
42
- else:
43
- from typing_extensions import Annotated
44
-
45
40
  NumType = Union[float, int]
46
41
  BoundsType = Tuple[NumType, NumType]
47
42
  LL_EPSILON = 1e-11
@@ -499,7 +494,9 @@ class TileMatrixSet(BaseModel, arbitrary_types_allowed=True):
499
494
  """Set private attributes."""
500
495
  super().__init__(**data)
501
496
 
502
- self._geographic_crs = data.get("_geographic_crs", WGS84_CRS)
497
+ self._geographic_crs = pyproj.CRS.from_user_input(
498
+ data.get("_geographic_crs", WGS84_CRS)
499
+ )
503
500
 
504
501
  try:
505
502
  self._to_geographic = pyproj.Transformer.from_crs(
@@ -184,6 +184,11 @@ def cli(ctx, verbose, quiet):
184
184
  default=None,
185
185
  help="Shift shape x and y values by a constant number",
186
186
  )
187
+ @click.option(
188
+ "--tms",
189
+ help="Path to TileMatrixSet JSON file.",
190
+ type=click.Path(),
191
+ )
187
192
  @click.pass_context
188
193
  def shapes( # noqa: C901
189
194
  ctx,
@@ -198,6 +203,7 @@ def shapes( # noqa: C901
198
203
  collect,
199
204
  extents,
200
205
  buffer,
206
+ tms,
201
207
  ):
202
208
  """
203
209
  Reads one or more Web Mercator tile descriptions
@@ -217,7 +223,10 @@ def shapes( # noqa: C901
217
223
  the properties object of the output feature.
218
224
 
219
225
  """
220
- tms = morecantile.tms.get(identifier)
226
+ tilematrixset = morecantile.tms.get(identifier)
227
+ if tms:
228
+ with open(tms, "r") as f:
229
+ tilematrixset = morecantile.TileMatrixSet(**json.load(f))
221
230
 
222
231
  dump_kwds = {"sort_keys": True}
223
232
  if indent:
@@ -243,7 +252,7 @@ def shapes( # noqa: C901
243
252
  else:
244
253
  raise click.BadParameter("{0}".format(obj), param=input, param_hint="input")
245
254
 
246
- feature = tms.feature(
255
+ feature = tilematrixset.feature(
247
256
  (x, y, z),
248
257
  fid=fid,
249
258
  props=props,
@@ -273,7 +282,7 @@ def shapes( # noqa: C901
273
282
  click.echo(
274
283
  json.dumps(
275
284
  {"type": "FeatureCollection", "bbox": bbox, "features": features},
276
- **dump_kwds
285
+ **dump_kwds,
277
286
  )
278
287
  )
279
288
 
@@ -302,8 +311,13 @@ def shapes( # noqa: C901
302
311
  default=False,
303
312
  help="Write a RS-delimited JSON sequence (default is LF).",
304
313
  )
314
+ @click.option(
315
+ "--tms",
316
+ help="Path to TileMatrixSet JSON file.",
317
+ type=click.Path(),
318
+ )
305
319
  @click.pass_context
306
- def tiles(ctx, zoom, input, identifier, seq): # noqa: C901
320
+ def tiles(ctx, zoom, input, identifier, seq, tms): # noqa: C901
307
321
  """
308
322
  Lists TMS tiles at ZOOM level intersecting
309
323
  GeoJSON [west, south, east, north] bounding boxen, features, or
@@ -324,7 +338,10 @@ def tiles(ctx, zoom, input, identifier, seq): # noqa: C901
324
338
  [853, 1551, 12]
325
339
 
326
340
  """
327
- tms = morecantile.tms.get(identifier)
341
+ tilematrixset = morecantile.tms.get(identifier)
342
+ if tms:
343
+ with open(tms, "r") as f:
344
+ tilematrixset = morecantile.TileMatrixSet(**json.load(f))
328
345
 
329
346
  for obj in normalize_source(input):
330
347
  if isinstance(obj, list):
@@ -362,7 +379,9 @@ def tiles(ctx, zoom, input, identifier, seq): # noqa: C901
362
379
  east -= epsilon
363
380
  north -= epsilon
364
381
 
365
- for tile in tms.tiles(west, south, east, north, [zoom], truncate=False):
382
+ for tile in tilematrixset.tiles(
383
+ west, south, east, north, [zoom], truncate=False
384
+ ):
366
385
  vals = (tile.x, tile.y, zoom)
367
386
  output = json.dumps(vals)
368
387
  if seq:
@@ -16,6 +16,7 @@ classifiers = [
16
16
  "Programming Language :: Python :: 3.9",
17
17
  "Programming Language :: Python :: 3.10",
18
18
  "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
19
20
  "Topic :: Scientific/Engineering :: GIS",
20
21
  ]
21
22
  dynamic = ["version"]
@@ -113,7 +114,7 @@ filterwarnings = [
113
114
  ]
114
115
 
115
116
  [tool.bumpversion]
116
- current_version = "5.3.1"
117
+ current_version = "5.4.1"
117
118
 
118
119
  search = "{current_version}"
119
120
  replace = "{new_version}"
File without changes
File without changes
File without changes