You may want to have a look at http://openlayers.org/dev/examples/mobile-wmts-vienna.js, which shows both how to configure WMTS layers manually and how to create them from a GetCapabilities response.
OpenLayers.Layer.XYZ won't help you in most cases, because WMTS layers can have a different grid layout for each resolution. Andreas. On Thu, Feb 21, 2013 at 5:29 AM, Donovan Cameron <[email protected]> wrote: > Hello OpenLayers List! > > My first time working with OL and I've been trying to get a WMTS[1] to load > in version 2.11 and feel like I'm getting close because it is grabbing > tiles, sort of... > > This is so that I can modify a plugin[2] for QGIS to let me load this WMTS > as a basemap. > > But I can't figure out what some of the needed parameters are - been trying > to interpret the GetCapabilities[1] xml and have figured some stuff out I > think. > > I'm using the OpenLayers.Layer.XYZ method because this WMTS use that form of > URL for requests: > http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg > > So under the OpenLayers.map part, I have... > maxExtent: new OpenLayers.Bounds(1799448.39, 6124949.74, 1848250.44, > 6162571.82) > > ...which I got from generating an extent polygon from the two x,y points > given by the Lower/UpperCorner in the TileMatrixSet. > > I don't know if that was the right way to get the bounds... but in QGIS[3] > it looks OK with overtop Google basemaps.. > > So then I used that polygons centre x,y to fill out the setCenter option: > map.setCenter(new OpenLayers.LonLat(1823849.41, 6143760.78), 0); > > I don't know what to enter for the maxResolution or if I've set the two > options correctly: > sphericalMercator: false, > wrapDateLine: false, > > The file I'm trying to get working is openlayers/html/schnittstellen.html > and that is found in the zipfile[4] I uploaded to my dropbox. > All the other HTML files in that folder work as expected. When I open that > file, it grabs an empty white tile and this is the example URL: > http://maps1.wien.gv.at/wmts/lb/farbe/google3857/0/67/52.jpg > > But I don't know why it's not working - can someone help me figure this out > please? Thanks in advance. > > [1] http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml > [2] http://plugins.qgis.org/plugins/openlayers_plugin/ > [3] http://susepaste.org/images/7ea74f53.jpeg > [4] https://dl.dropbox.com/u/33592962/outgoing/openlayers.zip > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
