diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/wmts-capabilities.js | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-0.0.4.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/wmts-capabilities.js')
-rw-r--r-- | misc/openlayers/examples/wmts-capabilities.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/misc/openlayers/examples/wmts-capabilities.js b/misc/openlayers/examples/wmts-capabilities.js new file mode 100644 index 0000000..103f5f5 --- /dev/null +++ b/misc/openlayers/examples/wmts-capabilities.js @@ -0,0 +1,58 @@ +OpenLayers.ProxyHost = "proxy.cgi/?url="; + +var map, format; + +function init() { + + format = new OpenLayers.Format.WMTSCapabilities({ + /** + * This particular service is not in compliance with the WMTS spec and + * is providing coordinates in y, x order regardless of the CRS. To + * work around this, we can provide the format a table of CRS URN that + * should be considered y, x order. These will extend the defaults on + * the format. + */ + yx: { + "urn:ogc:def:crs:EPSG::900913": true + } + }); + + OpenLayers.Request.GET({ + url: "http://v2.suite.opengeo.org/geoserver/gwc/service/wmts", + params: { + SERVICE: "WMTS", + VERSION: "1.0.0", + REQUEST: "GetCapabilities" + }, + success: function(request) { + var doc = request.responseXML; + if (!doc || !doc.documentElement) { + doc = request.responseText; + } + var capabilities = format.read(doc); + var layer = format.createLayer(capabilities, { + layer: "medford:buildings", + matrixSet: "EPSG:900913", + format: "image/png", + opacity: 0.7, + isBaseLayer: false + }); + map.addLayer(layer); + }, + failure: function() { + alert("Trouble getting capabilities doc"); + OpenLayers.Console.error.apply(OpenLayers.Console, arguments); + } + }); + + map = new OpenLayers.Map({ + div: "map", + projection: "EPSG:900913" + }); + + var osm = new OpenLayers.Layer.OSM(); + + map.addLayer(osm); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13); +} |