http://develop.smaryun.com:81/API/JS/OL5InterfaceDemo/index.htm
    image.png
    天地图是国家地理信息公开的地理数据,属于第三方地图。使用OpenLayer的接口对接,调用对应的接口获取数据。

    1. 8a5c2b00e94b49659861e064c37f778d
    1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
    6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    7. <title>Document</title>
    8. <script src="../lib/include-openlayers-local.js"></script>
    9. </head>
    10. <body>
    11. <div id="map_container">
    12. </div>
    13. <script>
    14. const TianDiMap_vec = new ol.layer.Tile({
    15. title:"天地图矢量图层",
    16. source:new ol.source.XYZ({
    17. url:'http://t0.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=' +
    18. '8a5c2b00e94b49659861e064c37f778d',
    19. wrapX:false
    20. })
    21. })
    22. const TianDiMap_cva = new ol.layer.Tile({
    23. title:"天地图矢量注记图层",
    24. source:new ol.source.XYZ({
    25. url:'http://t0.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=' +
    26. '8a5c2b00e94b49659861e064c37f778d',
    27. wrapX:false
    28. })
    29. })
    30. const map = new ol.Map({
    31. target:'map_container',
    32. layers:[TianDiMap_vec,TianDiMap_cva],
    33. view:new ol.View({
    34. projection:'EPSG:4326',
    35. center:[0,0],
    36. zoom:1
    37. })
    38. })
    39. </script>
    40. </body>
    41. </html>