Skip to content

Commit bb0207b

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

File tree

6 files changed

+23
-14
lines changed

6 files changed

+23
-14
lines changed

docs/api/sources.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sources
2+
3+
::: openlayers.sources

docs/concepts/layers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sources state which data the map should display.
1010
-8<-- "concepts/sources.py"
1111
```
1212

13-
> See [Sources API](../../api/layers/)
13+
> See [Sources API](../../api/sources/)
1414
1515
## Layers
1616

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ nav:
4343
- Map: api/map.md
4444
- Controls: api/controls.md
4545
- Layers: api/layers.md
46+
- Sources: api/sources.md
4647
- Styles: api/styles.md
4748
- Basemaps: api/basemaps.md
4849
- GeoPandas: api/geopandas.md

src/openlayers/models/layers.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,12 @@ def validate_style(cls, v):
4444
return v
4545

4646

47-
# TODO: Inherit from `VectorTileLayer`
4847
class VectorLayer(VectorTileLayer):
4948
"""A layer for rendering vector sources"""
5049

5150
# style: dict | FlatStyle | None = default_style()
5251
fit_bounds: bool = Field(False, serialization_alias="fitBounds")
5352

54-
"""
55-
@field_validator("style")
56-
def validate_style(cls, v):
57-
if isinstance(v, FlatStyle):
58-
return v.model_dump()
59-
60-
return v
61-
"""
62-
6353

6454
class VectorImageLayer(VectorLayer):
6555
"""A layer for rendering vector sources
@@ -84,7 +74,11 @@ class WebGLVectorTileLayer(VectorTileLayer): ...
8474

8575

8676
class WebGLTileLayer(Layer):
87-
# See https://openlayers.org/en/latest/apidoc/module-ol_layer_WebGLTile.html#~Style
77+
"""WebGLTile layer
78+
79+
Note:
80+
See [WebGLTile](https://openlayers.org/en/latest/apidoc/module-ol_layer_WebGLTile.html) for details.
81+
"""
8882
style: dict | None = None
8983

9084

src/openlayers/models/sources.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ class OSM(Source):
2727

2828

2929
class GeoTIFFSource(Source):
30-
"""GeoTIFF source"""
30+
"""GeoTIFF source
31+
32+
Examples:
33+
>>> import ol
34+
>>> geotiff = ol.GeoTIFFSource(sources=[{"url": "https://s2downloads.eox.at/demo/EOxCloudless/2020/rgbnir/s2cloudless2020-16bits_sinlge-file_z0-4.tif"}])
35+
"""
3136

3237
normalize: bool | None = None
3338
sources: list[dict]
@@ -46,7 +51,7 @@ class VectorTileSource(ImageTileSource):
4651
"""A source for vector data divided into a tile grid
4752
4853
Note:
49-
See [VectorTile](https://openlayers.org/en/latest/apidoc/module-ol_source_VectorTile-VectorTile.html)
54+
See [VectorTile](https://openlayers.org/en/latest/apidoc/module-ol_source_VectorTile-VectorTile.html) for details.
5055
"""
5156

5257
...
@@ -69,11 +74,15 @@ def type(self) -> str:
6974
# PMTiles extension
7075
# See https://docs.protomaps.com/pmtiles/openlayers
7176
class PMTilesVectorSource(Source):
77+
"""PMTiles vector source"""
78+
7279
url: str
7380
attributions: list[str] = None
7481

7582

7683
class PMTilesRasterSource(PMTilesVectorSource):
84+
"""PMTiles raster source"""
85+
7786
tile_size: tuple[int, int] = Field(None, serialization_alias="tileSize")
7887

7988

src/openlayers/sources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
VectorTileSource,
1111
TileJSONSource,
1212
PMTilesVectorSource,
13+
PMTilesRasterSource,
1314
)
1415

1516
__all__ = [
@@ -20,4 +21,5 @@
2021
"VectorTileSource",
2122
"TileJSONSource",
2223
"PMTilesVectorSource",
24+
"PMTilesRasterSource",
2325
]

0 commit comments

Comments
 (0)