Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <script src="http://openlayers.org/api/2.12-rc7/OpenLayers.js"></script>
- <link rel="stylesheet" href="http://dev.openlayers.org/releases/OpenLayers-2.11/examples/style.css" type="text/css">
- <script>
- var map;
- function init() {
- var epsg = "EPSG:23029";
- var bounds = new OpenLayers.Bounds(460000,4625000,690000,4855000);
- var options = {
- projection: new OpenLayers.Projection(epsg),
- displayProjection: new OpenLayers.Projection(epsg),
- units: "m",
- tileSize: new OpenLayers.Size(256,256),
- maxExtent: bounds
- };
- map = new OpenLayers.Map("map",options);
- //mymatrixids29: extraido del capabilities del servicio "mtn25ign@23029"
- var mymatrixids29 =[{"supportedCRS":"EPSG:23029","identifier":"5","scaleDenominator":8719308.03571429,"topLeftCorner":{"lon":0,"lat":5000000},"tileWidth":256,"tileHeight":256,"matrixWidth":3,"matrixHeight":2},{"supportedCRS":"EPSG:23029","identifier":"6","scaleDenominator":4359654.01785714,"topLeftCorner":{"lon":312500,"lat":5000000},"tileWidth":256,"tileHeight":256,"matrixWidth":5,"matrixHeight":4},{"supportedCRS":"EPSG:23029","identifier":"7","scaleDenominator":2179827.00892857,"topLeftCorner":{"lon":312500,"lat":5000000},"tileWidth":256,"tileHeight":256,"matrixWidth":9,"matrixHeight":7},{"supportedCRS":"EPSG:23029","identifier":"8","scaleDenominator":1089913.50446429,"topLeftCorner":{"lon":390625,"lat":5000000},"tileWidth":256,"tileHeight":256,"matrixWidth":17,"matrixHeight":13},{"supportedCRS":"EPSG:23029","identifier":"9","scaleDenominator":544956.752232143,"topLeftCorner":{"lon":429687.5,"lat":4960937.5},"tileWidth":256,"tileHeight":256,"matrixWidth":33,"matrixHeight":25},{"supportedCRS":"EPSG:23029","identifier":"10","scaleDenominator":272478.376116071,"topLeftCorner":{"lon":449218.75,"lat":4941406.25},"tileWidth":256,"tileHeight":256,"matrixWidth":66,"matrixHeight":48},{"supportedCRS":"EPSG:23029","identifier":"11","scaleDenominator":136239.188058036,"topLeftCorner":{"lon":449218.75,"lat":4941406.25},"tileWidth":256,"tileHeight":256,"matrixWidth":131,"matrixHeight":95},{"supportedCRS":"EPSG:23029","identifier":"12","scaleDenominator":68119.5940290179,"topLeftCorner":{"lon":454101.5625,"lat":4941406.25},"tileWidth":256,"tileHeight":256,"matrixWidth":261,"matrixHeight":189},{"supportedCRS":"EPSG:23029","identifier":"13","scaleDenominator":34059.7970145089,"topLeftCorner":{"lon":454101.5625,"lat":4941406.25},"tileWidth":256,"tileHeight":256,"matrixWidth":521,"matrixHeight":377},{"supportedCRS":"EPSG:23029","identifier":"14","scaleDenominator":17029.8985072545,"topLeftCorner":{"lon":454101.5625,"lat":4940185.546875},"tileWidth":256,"tileHeight":256,"matrixWidth":1041,"matrixHeight":753},{"supportedCRS":"EPSG:23029","identifier":"15","scaleDenominator":8514.94925362723,"topLeftCorner":{"lon":454711.9140625,"lat":4939575.1953125},"tileWidth":256,"tileHeight":256,"matrixWidth":2080,"matrixHeight":1505},{"supportedCRS":"EPSG:23029","identifier":"16","scaleDenominator":4257.47462681362,"topLeftCorner":{"lon":454711.9140625,"lat":4939270.0195313},"tileWidth":256,"tileHeight":256,"matrixWidth":4160,"matrixHeight":3009},{"supportedCRS":"EPSG:23029","identifier":"17","scaleDenominator":2128.73731340681,"topLeftCorner":{"lon":454711.9140625,"lat":4939270.0195313},"tileWidth":256,"tileHeight":256,"matrixWidth":8319,"matrixHeight":6017},{"supportedCRS":"EPSG:23029","identifier":"18","scaleDenominator":1064.3686567034,"topLeftCorner":{"lon":454788.20800781,"lat":4939193.7255859},"tileWidth":256,"tileHeight":256,"matrixWidth":16636,"matrixHeight":12033}];
- var iberpixLayer = new OpenLayers.Layer.WMTS({
- name: "Iberpix",
- url: "http://www.ign.es/wmts/ot/wmtsservice.aspx",
- layer: "mtn25ign",
- matrixSet: "mtn25ign@23029",
- matrixIds: mymatrixids29,
- format: "image/jpeg",
- style: "default",
- isBaseLayer: true
- });
- map.addLayer(iberpixLayer);
- var topoLayer = new OpenLayers.Layer.WMS("IGN-Base",
- "http://www.ign.es/wms-inspire/ign-base", {
- layers: "IGNBaseTodo"
- }, {
- isBaseLayer: true,
- buffer: 0,
- transitionEffect: 'resize',
- visibility: false
- }
- );
- map.addLayer(topoLayer);
- map.addControl(new OpenLayers.Control.LayerSwitcher());
- map.zoomToExtent(bounds, true);
- }
- </script>
- </head>
- <body onload="init();">
- <h1 id="title">Prueba de WMTS del IGN en Galicia</h1>
- <p>
- IGN wmts en galicia
- </p>
- <div id="map" class="smallmap"></div>
- <p>Al cambiar de capa en base, se puede ver el desplazamiento de la capa WMTS</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement