controler_markersWithCustomIcons.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_markersWithCustomIcons"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. <script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
  11. </head>
  12. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  13. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  14. <script type="text/javascript">
  15. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  16. var map,
  17. baseUrl = host + "/iserver/services/map-world/rest/maps/World";
  18. map = L.map('map', {
  19. crs: L.CRS.EPSG4326,
  20. center: {lon: 116.92866163503169, lat: 39.830660058696104},
  21. maxZoom: 18,
  22. zoom: 5
  23. });
  24. var greenIcon = L.icon({
  25. iconUrl: '../img/leaf-green.png',
  26. shadowUrl: '../img/leaf-shadow.png',
  27. iconSize: [38, 95],
  28. shadowSize: [50, 64],
  29. iconAnchor: [22, 94],
  30. shadowAnchor: [4, 62],
  31. popupAnchor: [-3, -76]
  32. });
  33. L.marker([39.830660058696104, 116.92866163503169], {icon: greenIcon}).bindPopup(resources.text_beijingCity).addTo(map);
  34. L.supermap.tiledMapLayer(baseUrl).addTo(map);
  35. </script>
  36. </body>
  37. </html>