titiler.core 2.0.0__tar.gz → 2.0.0a2__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 (46) hide show
  1. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/.gitignore +0 -1
  2. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/PKG-INFO +2 -2
  3. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/pyproject.toml +1 -1
  4. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/__init__.py +1 -1
  5. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/dependencies.py +3 -32
  6. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/map.html +22 -36
  7. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/LICENSE +0 -0
  8. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/README.md +0 -0
  9. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/__init__.py +0 -0
  10. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/base.py +0 -0
  11. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/dem.py +0 -0
  12. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/image.py +0 -0
  13. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/index.py +0 -0
  14. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/math.py +0 -0
  15. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/algorithm/ops.py +0 -0
  16. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/errors.py +0 -0
  17. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/factory.py +0 -0
  18. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/middleware.py +0 -0
  19. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/models/OGC.py +0 -0
  20. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/models/__init__.py +0 -0
  21. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/models/common.py +0 -0
  22. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/models/mapbox.py +0 -0
  23. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/models/responses.py +0 -0
  24. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/py.typed +0 -0
  25. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/resources/__init__.py +0 -0
  26. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/resources/enums.py +0 -0
  27. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/resources/responses.py +0 -0
  28. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/routing.py +0 -0
  29. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/telemetry.py +0 -0
  30. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/algorithm.html +0 -0
  31. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/algorithms.html +0 -0
  32. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/base.html +0 -0
  33. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/colormap.html +0 -0
  34. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/colormaps.html +0 -0
  35. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/debug.html +0 -0
  36. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/footer.html +0 -0
  37. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/header.html +0 -0
  38. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/icons/clock.html +0 -0
  39. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/icons/license.html +0 -0
  40. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/icons/tag.html +0 -0
  41. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/tilematrixset.html +0 -0
  42. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/tilematrixsets.html +0 -0
  43. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/tileset.html +0 -0
  44. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/templates/tilesets.html +0 -0
  45. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/utils.py +0 -0
  46. {titiler_core-2.0.0 → titiler_core-2.0.0a2}/titiler/core/validation.py +0 -0
@@ -48,7 +48,6 @@ htmlcov/
48
48
  .cache
49
49
  nosetests.xml
50
50
  coverage.xml
51
- titiler-*.xml
52
51
  *.cover
53
52
  .hypothesis/
54
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: titiler-core
3
- Version: 2.0.0
3
+ Version: 2.0.0a2
4
4
  Summary: A modern dynamic tile server built on top of FastAPI and Rasterio/GDAL.
5
5
  Project-URL: Homepage, https://developmentseed.org/titiler/
6
6
  Project-URL: Documentation, https://developmentseed.org/titiler/
@@ -28,7 +28,7 @@ Requires-Dist: morecantile
28
28
  Requires-Dist: numpy
29
29
  Requires-Dist: pydantic~=2.0
30
30
  Requires-Dist: rasterio
31
- Requires-Dist: rio-tiler<10.0,>=9.0
31
+ Requires-Dist: rio-tiler<10.0,>=9.0.0a4
32
32
  Requires-Dist: simplejson
33
33
  Provides-Extra: telemetry
34
34
  Requires-Dist: opentelemetry-api; extra == 'telemetry'
@@ -36,7 +36,7 @@ dependencies = [
36
36
  "numpy",
37
37
  "pydantic~=2.0",
38
38
  "rasterio",
39
- "rio-tiler>=9.0,<10.0",
39
+ "rio-tiler>=9.0.0a4,<10.0",
40
40
  "morecantile",
41
41
  "simplejson",
42
42
  ]
@@ -1,6 +1,6 @@
1
1
  """titiler.core"""
2
2
 
3
- __version__ = "2.0.0"
3
+ __version__ = "2.0.0a2"
4
4
 
5
5
  from . import dependencies, errors, factory, routing # noqa
6
6
  from .factory import ( # noqa
@@ -3,16 +3,16 @@
3
3
  import json
4
4
  from collections.abc import Callable, Sequence
5
5
  from dataclasses import dataclass, field
6
- from typing import Annotated, Any, Literal, cast
6
+ from typing import Annotated, Literal
7
7
 
8
8
  import numpy
9
9
  from fastapi import HTTPException, Query
10
- from pydantic import AfterValidator, BeforeValidator, Field
10
+ from pydantic import BeforeValidator, Field
11
11
  from rasterio.crs import CRS
12
12
  from rio_tiler.colormap import ColorMaps
13
13
  from rio_tiler.colormap import cmap as default_cmap
14
14
  from rio_tiler.colormap import parse_color
15
- from rio_tiler.types import AssetType, AssetWithOptions, RIOResampling, WarpResampling
15
+ from rio_tiler.types import RIOResampling, WarpResampling
16
16
  from starlette.requests import Request
17
17
 
18
18
  from titiler.core.resources.enums import ImageType, MediaType
@@ -134,37 +134,12 @@ class BidxExprParams(ExpressionParams, BidxParams):
134
134
 
135
135
 
136
136
  # Dependencies for MultiBaseReader (e.g STACReader)
137
- def _parse_asset(values: list[str]) -> list[AssetType]:
138
- """Parse assets with optional parameter."""
139
- assets: list[AssetType] = []
140
- for v in values:
141
- if "|" in v:
142
- asset_name, params = v.split("|", 1)
143
- opts: dict[str, Any] = {"name": asset_name}
144
- for option in params.split("|"):
145
- key, value = option.split("=", 1)
146
- if key == "bidx":
147
- opts["indexes"] = list(map(int, value.split(",")))
148
- elif key == "expression":
149
- opts["expression"] = value
150
- elif key == "bands":
151
- opts["bands"] = value.split(",")
152
-
153
- asset = cast(AssetWithOptions, opts)
154
- assets.append(asset)
155
- else:
156
- assets.append(v)
157
-
158
- return assets
159
-
160
-
161
137
  @dataclass
162
138
  class AssetsParams(DefaultDependency):
163
139
  """Assets parameters."""
164
140
 
165
141
  assets: Annotated[
166
142
  list[str],
167
- AfterValidator(_parse_asset),
168
143
  Query(
169
144
  title="Asset names",
170
145
  description="Asset's names.",
@@ -178,10 +153,6 @@ class AssetsParams(DefaultDependency):
178
153
  "description": "Return results for assets `data` and `cog`.",
179
154
  "value": ["data", "cog"],
180
155
  },
181
- "multi-assets-with-options": {
182
- "description": "Return results for assets `data` and `cog`.",
183
- "value": ["data|bidx=1", "cog|bidx=1,2"],
184
- },
185
156
  },
186
157
  ),
187
158
  ]
@@ -249,7 +249,6 @@
249
249
 
250
250
  fetch(`{{ point_endpoint|safe }}`.replace('{lat}', lat).replace('{lon}', lng))
251
251
  .then(res => {
252
- if (res.status === 204) return null;
253
252
  if (res.ok) return res.json();
254
253
 
255
254
  return res.json().then(errorData => {
@@ -260,44 +259,31 @@
260
259
  })
261
260
  })
262
261
  .then(data => {
263
- if (data === null) {
264
- popup.setContent(`<p>No data at ${lat}, ${lng}</p>`);
265
- return;
266
- }
262
+ const formatPopupContent = (data) => {
263
+ let html = '<div style="max-width: 250px;">';
267
264
 
268
- const renderBandTable = (bandNames, values) => {
269
- if (bandNames.length === 1) {
270
- const value = values[0] !== null ? values[0] : 'No data';
271
- return `<p><strong>Value:</strong> ${value}</p>`;
272
- }
273
- let html = '<table style="width: 100%; border-collapse: collapse;">';
274
- html += '<tr>'
275
- + '<th style="text-align: left; padding: 1px; border-bottom: 1px solid #ddd;">Band</th>'
276
- + '<th style="text-align: right; padding: 1px; border-bottom: 1px solid #ddd;">Value</th>'
277
- + '</tr>';
278
- for (let i = 0; i < bandNames.length; i++) {
279
- const value = values[i] !== null ? values[i] : 'No data';
280
- html += `<tr>
281
- <td style="text-align: left; padding: 1px;">${bandNames[i]}</td>
282
- <td style="text-align: right; padding: 1px;">${value}</td>
283
- </tr>`;
284
- }
285
- html += '</table>';
286
- return html;
287
- };
265
+ html += `<p><strong>Coordinates:</strong> ${lat}, ${lng}</p>`;
288
266
 
289
- const formatPopupContent = (data) => {
290
- let html = `<div style="max-width: 250px;">
291
- <p><strong>Coordinates:</strong> ${lat}, ${lng}</p>`;
292
-
293
- if (data.values !== undefined) {
294
- // TilerFactory shape: flat band list
295
- html += renderBandTable(data.band_names, data.values);
296
- } else if (data.assets !== undefined) {
297
- // MosaicTilerFactory shape: one entry per asset
298
- for (const asset of data.assets) {
299
- html += renderBandTable(asset.band_names, asset.values);
267
+ // single band case - just show the value
268
+ if (data.band_names.length === 1) {
269
+ const value = data.values[0] !== null ? data.values[0] : 'No data';
270
+ html += `<p><strong>Value:</strong> ${value}</p>`;
271
+ }
272
+ // multiple bands case - show in a table
273
+ else {
274
+ html += '<table style="width: 100%; border-collapse: collapse;">';
275
+ html += '<tr><th style="text-align: left; padding: 1px; border-bottom: 1px solid #ddd;">Band</th>' +
276
+ '<th style="text-align: right; padding: 1px; border-bottom: 1px solid #ddd;">Value</th></tr>';
277
+
278
+ for (let i = 0; i < data.band_names.length; i++) {
279
+ const value = data.values[i] !== null ? data.values[i] : 'No data';
280
+ html += `<tr>
281
+ <td style="text-align: left; padding: 1px;">${data.band_names[i]}</td>
282
+ <td style="text-align: right; padding: 1px;">${value}</td>
283
+ </tr>`;
300
284
  }
285
+
286
+ html += '</table>';
301
287
  }
302
288
 
303
289
  html += '</div>';
File without changes
File without changes