Skip to content

Commit ff9e373

Browse files
committed
refactor(ol-source-stadia-maps): replace old ol-stamen component
BREAKING CHANGE: The new component `ol-source-stadia-maps` replaced the old `ol-source-stamen` component. Please checkout the official [OpenLayers 8 release notes](https://github.com/openlayers/openlayers/blob/v8.0.0/changelog/upgrade-notes.md#new-stadiamaps-source-replaces-the-stamen-source) for further information.
1 parent a76dd57 commit ff9e373

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Properties are mostly reflected 1:1 from OpenLayers as Component Properties for
4949
- 👩🏻‍🔧 migrated all components to use [`<script setup>` syntax](https://vuejs.org/api/sfc-script-setup.html)
5050
- 🗺️ aligned API with [OpenLayers 7.4.0](https://github.com/openlayers/openlayers/releases/tag/v7.4.0)
5151
- 📘 updated & restructured the whole documentation
52-
- 🧩 added new components: `ol-layer-group`, `ol-source-tile-json`, `ol-source-stamen` and `ol-vector-image-layer`
52+
- 🧩 added new components: `ol-layer-group`, `ol-source-tile-json`, `ol-source-stadia-maps` and `ol-vector-image-layer`
5353
- 🚀 expose all interactions to be able to call access them via `ref` in templates
5454
- 🐞 lot's of bug fixes
5555
- 📖 improved the documentation

docs/.vitepress/config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ export default defineConfig({
134134
link: "/componentsguide/sources/osm/",
135135
},
136136
{
137-
text: "ol-source-stamen",
138-
link: "/componentsguide/sources/stamen/",
137+
text: "ol-source-stadia-maps",
138+
link: "/componentsguide/sources/stadiamaps/",
139139
},
140140
{
141141
text: "ol-source-tianditu",

docs/componentsguide/sources/stamen/index.md renamed to docs/componentsguide/sources/stadiamaps/index.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# ol-source-stamen
1+
# ol-source-stadia-maps
22

3-
> Layer source for the Stamen tile server.
3+
> Layer source for the StadiaMaps tile server.
44
55
<script setup>
6-
import StamenDemo from "@demos/StamenDemo.vue"
6+
import StadiaMapsDemo from "@demos/StadiaMapsDemo.vue"
77
</script>
88

99
<ClientOnly>
10-
<StamenDemo />
10+
<StadiaMapsDemo />
1111
</ClientOnly>
1212

1313
## Usage
1414

1515
::: code-group
1616

17-
<<< ../../../../src/demos/StamenDemo.vue
17+
<<< ../../../../src/demos/StadiaMapsDemo.vue
1818

1919
:::
2020

@@ -23,7 +23,7 @@ import StamenDemo from "@demos/StamenDemo.vue"
2323
### Props from OpenLayers
2424

2525
Properties are passed-trough from OpenLayers directly.
26-
Their types and default values can be checked-out [in the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_Stamen-Stamen.html).
26+
Their types and default values can be checked-out [in the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_StadiaMaps-StadiaMaps.html).
2727
Only some properties deviate caused by reserved keywords from Vue / HTML.
2828
This deviating props are described in the section below.
2929

@@ -34,34 +34,34 @@ None.
3434
## Events
3535

3636
You have access to all Events from the underlying source.
37-
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_Stamen-Stamen.html) to see the available events tht will be fired.
37+
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_StadiaMaps-StadiaMaps.html) to see the available events tht will be fired.
3838

3939
```html
40-
<ol-source-stamen layer="watercolor" @error="handleEvent" />
40+
<ol-source-stadia-maps layer="stamen_watercolor" @error="handleEvent" />
4141
```
4242

4343
## Methods
4444

4545
You have access to all Methods from the underlying source.
46-
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_Stamen-Stamen.html) to see the available methods.
46+
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_StadiaMaps-StadiaMaps.html) to see the available methods.
4747

4848
To access the source, you can use a `ref()` as shown below:
4949

5050
```vue
5151
<template>
5252
<!-- ... -->
53-
<ol-source-stamen layer="watercolor" ref="sourceRef" />
53+
<ol-source-stadia-maps layer="stamen_watercolor" ref="sourceRef" />
5454
<!-- ... -->
5555
</template>
5656
5757
<script setup lang="ts">
5858
import { ref, onMounted } from "vue";
59-
import type Stamen from "ol/source/Stamen";
59+
import type StadiaMaps from "ol/source/StadiaMaps";
6060
61-
const sourceRef = ref<{ source: Stamen }>(null);
61+
const sourceRef = ref<{ source: StadiaMaps }>(null);
6262
6363
onMounted(() => {
64-
const source: Stamen = sourceRef.value?.source;
64+
const source: StadiaMaps = sourceRef.value?.source;
6565
// call your method on `source`
6666
});
6767
</script>

docs/public/sitemap.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<priority>0.80</priority>
8989
</url>
9090
<url>
91-
<loc>https://vue3openlayers.netlify.app/componentsguide/sources/stamen/</loc>
91+
<loc>https://vue3openlayers.netlify.app/componentsguide/sources/stadiamaps/</loc>
9292
<lastmod>2023-06-22T22:30:00+00:00</lastmod>
9393
<priority>0.80</priority>
9494
</url>

src/components/sources/OlSourceStamen.vue renamed to src/components/sources/OlSourceStadiaMaps.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</template>
44

55
<script setup lang="ts">
6-
import Stamen, { type Options } from "ol/source/Stamen";
6+
import StadiaMaps, { type Options } from "ol/source/StadiaMaps";
77
import { inject, onMounted, onUnmounted, watch, type Ref, computed } from "vue";
88
import usePropsAsObjectProperties from "@/composables/usePropsAsObjectProperties";
99
import type TileLayer from "ol/layer/Tile";
@@ -27,10 +27,12 @@ const props = withDefaults(defineProps<Options>(), {
2727
wrapX: true,
2828
});
2929
30-
const layer = inject<Ref<TileLayer<Stamen>> | null>("tileLayer");
30+
// NOTE: Layers from Stadia Maps do not require an API key for localhost development or most production
31+
// web deployments. See https://docs.stadiamaps.com/authentication/ for details.
32+
const layer = inject<Ref<TileLayer<StadiaMaps>> | null>("tileLayer");
3133
const { properties } = usePropsAsObjectProperties(props);
3234
33-
const source = computed(() => new Stamen(properties));
35+
const source = computed(() => new StadiaMaps(properties));
3436
3537
useOpenLayersEvents(source, [
3638
...TILE_SOURCE_EVENTS,

src/components/sources/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import OlSourceCluster from "./OlSourceCluster.vue";
44
import OlSourceImageStatic from "./OlSourceImageStatic.vue";
55
import OlSourceImageWMS from "./OlSourceImageWMS.vue";
66
import OlSourceOSM from "./OlSourceOSM.vue";
7-
import OlSourceStamen from "./OlSourceStamen.vue";
7+
import OlSourceStadiaMaps from "./OlSourceStadiaMaps.vue";
88
import OlSourceTianDiTu from "./OlSourceTianDiTu.vue";
99
import OlSourceTileArcGISRest from "@/components/sources/OlSourceTileArcGISRest.vue";
1010
import OlSourceTileJSON from "./OlSourceTileJSON.vue";
@@ -26,7 +26,7 @@ function install(app: App) {
2626
app.component("ol-source-image-static", OlSourceImageStatic);
2727
app.component("ol-source-image-wms", OlSourceImageWMS);
2828
app.component("ol-source-osm", OlSourceOSM);
29-
app.component("ol-source-stamen", OlSourceStamen);
29+
app.component("ol-source-stadia-maps", OlSourceStadiaMaps);
3030
app.component("ol-source-tianditu", OlSourceTianDiTu);
3131
app.component("ol-source-tile-arcgis-rest", OlSourceTileArcGISRest);
3232
app.component("ol-source-tile-json", OlSourceTileJSON);
@@ -47,7 +47,7 @@ export {
4747
OlSourceImageStatic,
4848
OlSourceImageWMS,
4949
OlSourceOSM,
50-
OlSourceStamen,
50+
OlSourceStadiaMaps,
5151
OlSourceTianDiTu,
5252
OlSourceTileArcGISRest,
5353
OlSourceTileJSON,

src/demos/StamenDemo.vue renamed to src/demos/StadiaMapsDemo.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
>
77
<ol-view ref="view" :center="center" :zoom="zoom" />
88
<ol-tile-layer>
9-
<ol-source-stamen layer="watercolor" />
9+
<ol-source-stadia-maps layer="stamen_watercolor" />
1010
</ol-tile-layer>
1111
<ol-tile-layer>
12-
<ol-source-stamen layer="terrain-labels" />
12+
<ol-source-stadia-maps layer="stamen_terrain_labels" />
1313
</ol-tile-layer>
1414
</ol-map>
1515
</template>

vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default defineConfig({
8484
"ol/proj": "proj",
8585
"ol/source/ImageWMS": "ImageWMS",
8686
"ol/source/OSM": "OSM",
87-
"ol/source/Stamen": "Stamen",
87+
"ol/source/StadiaMaps": "StadiaMaps",
8888
"ol/source/WMTS": "WMTSSource",
8989
"ol/tilegrid/WMTS": "TileGridWMTS",
9090
"ol/source/TileArcGISRest": "TileArcGISRest",

0 commit comments

Comments
 (0)