Skip to content

Commit 1148922

Browse files
author
Stefan Kuethe
committed
Update docs
1 parent 4e16c52 commit 1148922

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

examples/standalone/layers/tilejson_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import openlayers as ol
44

55
layer = ol.TileLayer(
6-
source=ol.TileJSON(
6+
source=ol.TileJSONSource(
77
url="https://maps.gnosis.earth/ogcapi/collections/NaturalEarth:raster:HYP_HR_SR_OB_DR/map/tiles/WebMercatorQuad?f=tilejson"
88
)
99
)

src/openlayers/models/sources.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,59 @@ class Source(OLBaseModel): ...
1212

1313
# --- Sources
1414
class VectorSource(Source):
15+
"""Vector source"""
16+
1517
url: str | None = None
1618
# features: list[dict] | None = None
1719
geojson: dict | None = Field(None, serialization_alias="@@geojson")
1820
format: FormatT | dict = GeoJSON()
1921

2022

21-
class OSM(Source): ...
23+
class OSM(Source):
24+
"""OSM source"""
25+
26+
...
2227

2328

2429
class GeoTIFFSource(Source):
30+
"""GeoTIFF source"""
31+
2532
normalize: bool | None = None
2633
sources: list[dict]
2734

2835

2936
class ImageTileSource(Source):
37+
"""Image tile source"""
38+
3039
url: str
3140
attributions: str | None = None
3241
min_zoom: float | int | None = Field(0, serialization_alias="minZoom")
3342
max_zoom: float | int | None = Field(20, serialization_alias="maxZoom")
3443

3544

36-
class VectorTileSource(ImageTileSource): ...
45+
class VectorTileSource(ImageTileSource):
46+
"""A source for vector data divided into a tile grid
47+
48+
Note:
49+
See [VectorTile](https://openlayers.org/en/latest/apidoc/module-ol_source_VectorTile-VectorTile.html)
50+
"""
3751

52+
...
53+
54+
55+
class TileJSONSource(ImageTileSource):
56+
"""A source for tile data in TileJSON format
57+
58+
Note:
59+
See [TileJSON](https://openlayers.org/en/latest/apidoc/module-ol_source_TileJSON-TileJSON.html) for details.
60+
"""
3861

39-
class TileJSON(ImageTileSource):
4062
cross_origin: str = Field("anonymous", serialization_alias="crossOrigin")
4163

64+
@property
65+
def type(self) -> str:
66+
return "TileJSON"
67+
4268

4369
# PMTiles extension
4470
# See https://docs.protomaps.com/pmtiles/openlayers
@@ -58,7 +84,7 @@ class PMTilesRasterSource(PMTilesVectorSource):
5884
GeoTIFFSource,
5985
ImageTileSource,
6086
ImageTileSource,
61-
TileJSON,
87+
TileJSONSource,
6288
PMTilesVectorSource,
6389
PMTilesRasterSource,
6490
]

src/openlayers/sources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
SourceT,
99
VectorSource,
1010
VectorTileSource,
11-
TileJSON,
11+
TileJSONSource,
1212
PMTilesVectorSource,
1313
)
1414

@@ -18,6 +18,6 @@
1818
"VectorSource",
1919
"ImageTileSource",
2020
"VectorTileSource",
21-
"TileJSON",
21+
"TileJSONSource",
2222
"PMTilesVectorSource",
2323
]

0 commit comments

Comments
 (0)