<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>二次开发示例</title>
<link rel="stylesheet" href="../OpenLayers2.11/theme/default/style.css" type="text/css" />
<script type="text/javascript" src="../OpenLayers2.11/OpenLayers.js"></script>
<script type="text/javascript" src="../OpenLayers2.11/OpenLayersEx.js?random=8852c822-1ab8-4c0a-9717-b6f4c2b98115"></script>
<!-- Import OpenLayers, reduced, wms read only version -->
<!--<script src="../OpenLayers.js" type="text/javascript"></script>-->
<script type="text/javascript">
var map;
var bounds = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);
function init() {
var options = {
controls:[new OpenLayers.Control.XPanZoomBar(),new OpenLayers.Control.Navigation(),new OpenLayers.Control.MousePosition({numDigits:2})] ,
projection: 'EPSG:900913',
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0339,
units: 'm',
zoomLevel: 8
};
map = new OpenLayers.Map('map',options);
/*{
div: "map",
projection: "EPSG:900913",
units: "m",
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
maxResolution: 156543.0339,
zoomLevel: 8
}*/
// var osm = new OpenLayers.Layer.OSM();
// If tile matrix identifiers differ from zoom levels (0, 1, 2, ...)
// then they must be explicitly provided.
var matrixIds = new Array(19);
for (var i=0; i<16; ++i) {
matrixIds[i] = i+"";
}
var wmts2 = new OpenLayers.Layer.WMTS({
name: "Medford Buildings",
url: "http://t0.tianditu.com/cia_w/wmts",
layer: "cia",
matrixSet: "w",
matrixIds: matrixIds,
format: "tiles",
style: "default",
opacity: 0.7,
isBaseLayer: false
});
var wmts = new OpenLayers.Layer.WMTS({
name: "vec",
url: "http://t0.tianditu.com/vec_w/wmts",
layer: "vec",
matrixSet: "w",
matrixIds: matrixIds,
format: "tiles",
style: "default",
opacity:1,
isBaseLayer: true
});
map.addLayers( [wmts,wmts2]);
// map.addControl(new OpenLayers.Control.LayerSwitcher());
// map.setCenter(new OpenLayers.LonLat(13391734.740566667,3535411.228859166),7);
map.moveTo(new OpenLayers.LonLat(13391734.740566667,3535411.228859166),7);
}
</script>
</head>
<body onload="init();">
<h1 id="title">Web Map Tile Service (WMTS) Layer</h1>
<div id="map" class="smallmap"></div>
</body>
</html>