13hightresbasemap.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>基础地图</title>
  7. <link rel="stylesheet" href="../dist/ol/ol.css" />
  8. <script src="../dist/index.js"></script>
  9. <style>*{padding:0;margin:0;}</style>
  10. </head>
  11. <body>
  12. <div id="map1" style="height: 50vh; width: 100vw;"></div>
  13. <div id="map2" style="height: 100vh; width: 200vw;transform-origin: left top;transform:scale(0.5,0.5);"></div>
  14. </body>
  15. <script>
  16. const source1 = new CTMapOl.source.XYZ({
  17. url: 'http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=86db5390161c4da2abe96c3fca00f403'
  18. })
  19. const tileLayer1 = new CTMapOl.layer.Tile({
  20. title: '天地图',
  21. source: source1
  22. })
  23. var sourceMarker1 = new CTMapOl.source.XYZ({
  24. url: 'http://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=86db5390161c4da2abe96c3fca00f403'
  25. })
  26. const tileMarker1 = new CTMapOl.layer.Tile({
  27. title: '标注图层',
  28. source: sourceMarker1
  29. })
  30. const map1 = new CTMapOl.Map({
  31. view: new CTMapOl.View({
  32. projection: 'EPSG:3857',
  33. center: CTMapOl.extend.formatLayer.transCooordinateToOpenlayer([116.39, 39.91]),
  34. // center: [0, 0],
  35. zoom: 16,
  36. maxZoom: 18,
  37. minZoom: 1
  38. }),
  39. layers: [tileLayer1, tileMarker1],
  40. target: 'map1'
  41. })
  42. const source2 = new CTMapOl.source.XYZ({
  43. url: 'http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=86db5390161c4da2abe96c3fca00f403'
  44. })
  45. const tileLayer2 = new CTMapOl.layer.Tile({
  46. title: '天地图',
  47. source: source2
  48. })
  49. var sourceMarker2 = new CTMapOl.source.XYZ({
  50. url: 'http://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=86db5390161c4da2abe96c3fca00f403'
  51. })
  52. const tileMarker2 = new CTMapOl.layer.Tile({
  53. title: '标注图层',
  54. source: sourceMarker2
  55. })
  56. const map2 = new CTMapOl.Map({
  57. view: new CTMapOl.View({
  58. projection: 'EPSG:3857',
  59. center: CTMapOl.extend.formatLayer.transCooordinateToOpenlayer([116.39, 39.91]),
  60. // center: [0, 0],
  61. zoom: 16,
  62. maxZoom: 18,
  63. minZoom: 1
  64. }),
  65. layers: [tileLayer2, tileMarker2],
  66. target: 'map2'
  67. })
  68. </script>
  69. </html>