Skip to content

Commit dc13f49

Browse files
author
Stefan Kuethe
committed
Update docs
1 parent 15a0173 commit dc13f49

File tree

11 files changed

+188
-95
lines changed

11 files changed

+188
-95
lines changed

docs/api/basemaps.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Basemaps
22

3-
::: openlayers.basemaps.BasemapLayer
3+
::: openlayers.basemaps.BasemapLayer
4+
5+
::: openlayers.basemaps.Carto

docs/api/controls.md

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

docs/examples/concepts/layers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
data = "https://openlayers.org/en/latest/examples/data/geojson/roads-seoul.geojson"
44

5-
geojson_layer = ol.VectorLayer(
5+
vector = ol.VectorLayer(
66
id="roads",
77
source=ol.VectorSource(url=data),
88
fit_bounds=True,
@@ -11,6 +11,6 @@
1111

1212
m = ol.Map(
1313
ol.View(rotation=3.14 / 8),
14-
layers=[ol.BasemapLayer.carto(), geojson_layer]
14+
layers=[ol.BasemapLayer.carto(), vector]
1515
)
1616
m.add_default_tooltip()

docs/examples/concepts/sources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import openlayers as ol
22

3-
geojson_source = ol.VectorSource(
3+
geojson = ol.VectorSource(
44
url="https://openlayers.org/en/latest/examples/data/geojson/roads-seoul.geojson"
55
)
66

7-
geotiff_source = ol.GeoTIFFSource(
7+
geotiff = ol.GeoTIFFSource(
88
sources=[{"url": "https://s2downloads.eox.at/demo/EOxCloudless/2020/rgbnir/s2cloudless2020-16bits_sinlge-file_z0-4.tif"}]
99
)
1010

11-
pmtiles_source = ol.PMTilesVectorSource(
11+
pmtiles = ol.PMTilesVectorSource(
1212
url="https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles",
1313
attributions=["© Land Information New Zealand"]
1414
)

docs/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,16 @@
33
```python
44
-8<-- "concepts/basic_map.py"
55
```
6+
7+
Use the `Map` class if you just want to create an HTML document and the `MapWidget` class for an interactive
8+
widget in _Marimo_ or _Jupyter_ notebooks:
9+
10+
```python
11+
# Widget
12+
m = ol.MapWidget(controls=[ol.ZoomSliderControl()])
13+
m
14+
15+
# Standalone
16+
m = Map(controls=[ol.ZoomSliderControl()])
17+
m.save()
18+
```

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ nav:
4747
- Styles: api/styles.md
4848
- Basemaps: api/basemaps.md
4949
- GeoPandas: api/geopandas.md
50-
- Express: api/express.md
50+
# - Express: api/express.md
5151
- Changelog: changelog.md

src/openlayers/basemaps.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222

2323
class Carto(Enum):
24+
"""CartoDB basemap styles"""
25+
2426
LIGHT_ALL = "light_all"
2527
DARK_ALL = "dark_all"
2628
VOYAGER_NO_LABLES = "rastertiles/voyager_nolabels"
@@ -59,12 +61,37 @@ def model(self) -> TileLayer:
5961

6062
@staticmethod
6163
def osm() -> TileLayer:
64+
"""Create a OSM tile layer object
65+
66+
Returns:
67+
An OSM raster tile layer
68+
69+
Examples:
70+
>>> from openlayers.basemaps import BasemapLayer
71+
>>> osm = BasemapLayer.osm()
72+
"""
6273
return TileLayer(id="osm", source=OSM())
6374

6475
@staticmethod
6576
def carto(
6677
style_name: str | Carto = Carto.DARK_ALL, double_resolution: bool = True
6778
) -> TileLayer:
79+
"""Create a CartoDB tile layer object
80+
81+
Note:
82+
See [CartoDB/basemap-styles](https://github.com/CartoDB/basemap-styles) for available styles.
83+
84+
Args:
85+
style_name (str | Carto): The name of the style
86+
double_resolution (bool): Whether to use double resolution tiles
87+
88+
Returns:
89+
A CartoDB raster tile layer
90+
91+
Examples:
92+
>>> from openlayers.basemaps import BasemapLayer
93+
>>> carto = BasemapLayer.carto()
94+
"""
6895
style = CartoRasterStyle(style=style_name, double_resolution=double_resolution)
6996
return TileLayer(
7097
id=f"carto-{Carto(style_name).value.replace('_', '-').replace('/', '-')}",

src/openlayers/controls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"OverviewMapControl",
2323
"ScaleLineControl",
2424
"ZoomSliderControl",
25+
"ZoomToExtentControl",
26+
"ZoomControl",
27+
"RotateControl",
2528
"MousePositionControl",
2629
"MapTilerGeocodingControl",
2730
"DrawControl",

src/openlayers/js/openlayers.anywidget.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/openlayers/js/openlayers.anywidget.js

Lines changed: 94 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)