1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_pulse"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
- <script type="text/javascript" include="leaflet-icon-pulse" src="../../dist/leaflet/include-leaflet.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var map, resultLayer, markers = [],
- dataUrl = host + "/iserver/services/data-DynamicData/rest/data",
- url = host + "/iserver/services/map-china400/rest/maps/China",
- pulseIcon = L.icon.pulse({
- iconSize: [12, 12],
- color: '#2f8'
- });
- map = L.map('map', {
- preferCanvas: true,
- center: [32, 104],
- maxZoom: 18,
- zoom: 4
- });
- L.supermap.tiledMapLayer(url).addTo(map);
- loadPulse();
- function loadPulse() {
- var point1 = L.CRS.EPSG3857.project(L.latLng(22, 96));
- var point2 = L.CRS.EPSG3857.project(L.latLng(42, 124));
- var bounds = L.latLngBounds(L.latLng(point1.y, point1.x), L.latLng(point2.y, point2.x));
- var boundsParam = new SuperMap.GetFeaturesByBoundsParameters({
- datasetNames: ["DynamicData:Point"],
- bounds: bounds
- });
- L.supermap
- .featureService(dataUrl)
- .getFeaturesByBounds(boundsParam, function (serviceResult) {
- createLayers(serviceResult.result.features);
- });
- }
- function createLayers(result) {
- if (!result || !result.features || result.features.length < 1) {
- return;
- }
- result.features.map(function (feature) {
- var latLng = L.CRS.EPSG3857.unproject(L.point(feature.geometry.coordinates));
- markers.push(L.marker(latLng, {icon: pulseIcon}));
- });
- resultLayer = L.featureGroup(markers).addTo(map);
- }
- </script>
- </body>
- </html>
|