Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

geoadmin map + leaflet + swisstopo.swissimage with "layers_timestamp"

117 views
Skip to first unread message

Vahid Moosavi

unread,
Nov 13, 2023, 3:35:30 PM11/13/23
to GeoAdminCh API
Hi 
Apologies if this has been discussed already. I couldn't find an answer for my case below. I really appreciate your answers:

I like to integrate "swisstopo.swissimage" into a simple leaflet map. 
as shown here and I do something like this:

var geoadminmap = new L.Map(LmapID, {
crs: L.CRS.EPSG3857,
continuousWorld: true,
worldCopyJump: false
});
var baselayer = new L.tileLayer.wms(url, {
layers: ['ch.swisstopo.swissimage-product'],
opacity: [1],
maxZoom: 22
});
geoadminmap.addLayer(baselayer);

and this works well. However, I am not sure how to choose a specific "layers_timestamp"
like here, if possible at all.

Thanks in advance


Pascal Barth

unread,
Nov 16, 2023, 6:58:42 AM11/16/23
to geoadm...@googlegroups.com
Hello,

You can set the year you want the way you did, by adding
var baselayer = new L.tileLayer.wms(url, {
layers: 'ch.swisstopo.swissimage-product',
time: 2000, // this is a year, the one you can find in the year selector on map.geo.admin.ch
});
 
Or you can use a TMS approach by setting the URL scheme with the year
const year = 1993  
const crs = 3857
const tms_example = L.tileLayer(`https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage-product/default/${year}/${crs}/{z}/{x}/{y}.jpeg`, {
tms: true })

Hope it helps,
Pascal

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/78af072b-e783-4e6c-83f1-9a82373a577bn%40googlegroups.com.

Vahid Moosavi

unread,
Nov 17, 2023, 11:58:13 AM11/17/23
to geoadm...@googlegroups.com
Thanks a lot Pascal! This works very well. 
But I am wondering if there is any API doc describing these additional parameters.
Best regards


You received this message because you are subscribed to a topic in the Google Groups "GeoAdminCh API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geoadmin-api/Z1LbG3rnro0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/CAL%2BBOM04EUEjKNMa%3DCF-okCZVCssuWfTDnBwzBzvuaoYBXUjHg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages