Swisstopo, OpenLayers 2 and WMTS

402 views
Skip to first unread message

Christian G.

unread,
Jun 23, 2015, 8:18:33 AM6/23/15
to geoadm...@googlegroups.com

Hello and thank you for your support.


I need a push in the right direction.

Our web applikation is still using the OpenLayer version 2 API. We are accessing various map sources, internal and external web Servers and add our own layer data.

I have a new requirement to implement Swisstopo WMTS sources. I’m currently looking at "ch.swisstopo.pixelkarte-farbe" and "ch.swisstopo.swissimage".
I managed to get some tiles, but when I zoom into it, it shifts the Position north/east. Is there an example for OL2 and Swisstopo?

Here is my layer...


var lyr1 = new OpenLayers.Layer.WMTS({
   requestEncoding: 'REST',
   name: "pixelkarte",
   url: ["
http://wmts9.geo.admin.ch/"],
   layer: "ch.swisstopo.pixelkarte-farbe",
   matrixSet: "21781",
   zoomOffset: 14,
   dimensions: ['TIME'],
   params: {
                        'time': '20151231'
                    },
   
   formatSuffix: "jpeg",
   style: "default",
   opacity: 1,
   isBaseLayer: true
  });    

Marc Monnerat

unread,
Jun 23, 2015, 9:26:23 AM6/23/15
to geoadmin-api
Hello Christian,

It is a bit more complicated than that. The origin is the same for each tileset, but the resolutions are customs.

Here is a fully functional example in codepen.io with OpenLayers v2 and geo.admin.ch WMTS


OpenLayers v2 has also the abilitiy to parse the WMTS GetCapabilities document for the service, for instance (webmercator!!!!)


for inspiration. You may use it with http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml. The big advantage here, is that the timestamps for layers is updated automatically.


Regards,

Marc

--
You received this message because you are subscribed to the Google Groups "GeoAdmin API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-- Τα πάντα ῥεῖ καὶ οὐδὲν μένει

Christian G.

unread,
Jun 23, 2015, 11:08:09 AM6/23/15
to geoadm...@googlegroups.com
Thank you Marc, 

It works like a swiss clock. You are my hero :-)

Cheers 
Christian

 
 


 

 
 
Reply all
Reply to author
Forward
0 new messages