1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_heatMapNY"></title>
- <script type="text/javascript" include="bootstrap-css,jquery,papaparse,widgets" 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.heat" src="../../dist/leaflet/include-leaflet.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var url = host + "/iserver/services/map-china400/rest/maps/ChinaDark";
- var map = L.map('map', {
- maxZoom: 20,
- center: [40.68, -73.92],
- zoom: 12,
- });
- var attribution = resources.text_dataSources+'<a target="_blank" href="http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml">NYC Taxi('+resources.text_NYTaxiCarPoint+')</a> Map Data <span>© <a href="http://support.supermap.com.cn/product/iServer.aspx" target="_blank">SuperMap iServer</a></span> with <span>© <a href="https://iclient.supermap.io" target="_blank">SuperMap iClient</a></span>';
- L.supermap.tiledMapLayer(url, {attribution: attribution}).addTo(map);
- loadHeatMap();
- function loadHeatMap() {
- //145万个点
- var radius = 30, opacity = 0.5;
- var length = 0;//需要截取示例数据的长度,0表示全部
- widgets.loader.showLoader();
- $.get('../data/nyc-taxi.csv', function (csvstr) {
- widgets.loader.removeLoader();
- var result = Papa.parse(csvstr, {skipEmptyLines: true, header: true});
- var heatPoints = processData(result, length);
- resultLayer = L.heatLayer(heatPoints, {
- radius: radius,
- minOpacity: opacity
- }).addTo(map);
- });
- }
- function processData(result, length) {
- var data = result.data;
- var len = (length < 1 || length > data.lenth || length == null) ? data.length : length;
- data = data.slice(0, len);
- return data;
- }
- </script>
- </body>
- </html>
|