GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — iClient-JavaScript/examples/leaflet/12_graphicLayer.html at master · lyinghappy/iClient-JavaScript

Expand file tree

/

12_graphicLayer.html

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
87 lines (80 loc) · 3.2 KB
/

12_graphicLayer.html

Copy path

File metadata and controls

87 lines (80 loc) · 3.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<title data-i18n="resources.title_graphicLayer"></title>
<script type="text/javascript" include="randomcolor,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" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map;
map = L.map('map', {
preferCanvas: true,
center: [40.74650, -73.89109999999999],
maxZoom: 18,
zoom: 12
});
var url = host + "/iserver/services/map-china/rest/maps/ChinaDark";
new L.supermap.TiledMapLayer(url).addTo(map);
var colorCount = 10;
var colors = getRandomColors(colorCount);
addGraphicLayer();
function addGraphicLayer() {
widgets.loader.showLoader();
$.get('../data/nyc_taxi_18W.csv', function (nycData) {
var features = Papa.parse(nycData, {skipEmptyLines: true, header: true}).data;
var count = features.length;
var graphics = [];
var circleStyles = [];
//创建圆的样式
for (var i = 0; i < colorCount; i++) {
circleStyles.push(new L.supermap.CircleStyle({
color: colors[i],
opacity: 1,
radius: Math.floor(Math.random() * 3 + 1),
fill: true,
fillColor: colors[i],
fillOpacity: 1
}));
}
//设置每个点的经纬度和传入圆的样式
for (var i = 0; i < count; ++i) {
var coordinates = [Number(features[i].X), Number(features[i].Y)];
if (coordinates[0] === coordinates[1]) {
continue;
}
graphics[i] = new L.supermap.Graphic({
latLng: L.latLng(coordinates[1], coordinates[0]),
style: circleStyles[Math.floor(Math.random() * colorCount)].getStyle()
});
}
//绘制图层
new L.supermap.GraphicLayer(graphics, {
render: "canvas",
onClick: function (graphic) {
L.popup().setLatLng(graphic.getLatLng())
.setContent('<p>' + resources.text_latLng + ':<br>' + graphic.getLatLng().lng + ',<br>' + graphic.getLatLng().lat + '</p>')
.openOn(map);
}
}).addTo(map);
widgets.loader.removeLoader();
})
}
//生成随机颜色
function getRandomColors(count) {
return randomColor({
luminosity: 'bright',
hue: 'random',
alpha: 0.5,
format: 'rgba',
count: count
});
}
</script>
</body>
</html>
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.