components_geojson_vue.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsGeoJSON_Vue"></title>
  9. <script type="text/javascript" include="vue,jquery,papaparse" src="../js/include-web.js"></script>
  10. <script
  11. include="iclient-mapboxgl-vue,mapbox-gl-enhance"
  12. src="../../dist/mapboxgl/include-mapboxgl.js"
  13. ></script>
  14. <style>
  15. #main {
  16. margin: 0 auto;
  17. width: 100%;
  18. height: 100%;
  19. }
  20. </style>
  21. </head>
  22. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  23. <div id="main">
  24. <sm-web-map :map-options="mapOptions">
  25. <sm-geojson-layer :layer-style="layerStyle" :data="data"></sm-geojson-layer>
  26. <sm-layer-list position="top-left"></sm-layer-list>
  27. </sm-web-map>
  28. </div>
  29. <script>
  30. var data;
  31. $.get("../data/data671MeteorologicalStations.geojson", function(res) {
  32. data = JSON.parse(res);
  33. new Vue({
  34. el: "#main",
  35. data() {
  36. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  37. var attribution =
  38. "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  39. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  40. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  41. return {
  42. data: data,
  43. layerStyle: new SuperMap.Components.commontypes.CircleStyle(),
  44. mapOptions: {
  45. container: "map", // container id
  46. style: {
  47. version: 8,
  48. sources: {
  49. "raster-tiles": {
  50. attribution: attribution,
  51. type: "raster",
  52. tiles: [
  53. host +
  54. "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}"
  55. ],
  56. tileSize: 256
  57. }
  58. },
  59. layers: [
  60. {
  61. id: "simple-tiles",
  62. type: "raster",
  63. source: "raster-tiles",
  64. minzoom: 0,
  65. maxzoom: 22
  66. }
  67. ]
  68. },
  69. center: [120.143, 30.236],
  70. zoom: 3
  71. }
  72. };
  73. }
  74. });
  75. });
  76. </script>
  77. </body>
  78. </html>