components_map_react.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_componentsMap_React'></title>
  9. <script type="text/javascript" include="react" src="../js/include-web.js"></script>
  10. <script include="antd,iclient-mapboxgl-react,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  11. <style>
  12. html,
  13. body {
  14. height: 100%;
  15. margin: 0;
  16. padding: 0;
  17. }
  18. #main {
  19. height: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id="main">
  25. </div>
  26. <script type="text/babel">
  27. // import {WebMap} from '@supermap/react-iclient'
  28. var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
  29. var attribution =
  30. "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  31. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  32. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  33. var SmWebMap = SuperMap.Components.SmWebMap;
  34. var mapOptions = {
  35. container: 'map',
  36. style: {
  37. version: 8,
  38. sources: {
  39. 'raster-tiles': {
  40. attribution: attribution,
  41. type: 'raster',
  42. tiles: [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}'],
  43. tileSize: 256
  44. }
  45. },
  46. layers: [
  47. {
  48. id: 'simple-tiles',
  49. type: 'raster',
  50. source: 'raster-tiles',
  51. minzoom: 0,
  52. maxzoom: 22
  53. }
  54. ]
  55. },
  56. center: [120.143, 30.236],
  57. zoom: 3
  58. };
  59. ReactDOM.render(<SmWebMap mapOptions={mapOptions} />, document.getElementById('main'));
  60. </script>
  61. </body>
  62. </html>