@hpcc-js/map 3.5.1 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/README.md +88 -88
- package/TopoJSON/BR.json +122 -122
- package/TopoJSON/GB_idx.json +1 -1
- package/TopoJSON/IE_idx.json +1 -1
- package/TopoJSON/ND_idx.json +1 -1
- package/TopoJSON/countries.json +257 -257
- package/TopoJSON/us-counties.json +16550 -16550
- package/TopoJSON/us-states.json +458 -458
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +9 -9
- package/src/CanvasPinLayer.ts +99 -99
- package/src/CanvasPins.ts +397 -397
- package/src/Choropleth.css +26 -26
- package/src/Choropleth.ts +203 -203
- package/src/ChoroplethContinents.ts +13 -13
- package/src/ChoroplethCounties.ts +111 -111
- package/src/ChoroplethCountries.ts +100 -100
- package/src/ChoroplethStates.ts +103 -103
- package/src/ChoroplethStatesHeat.ts +8 -8
- package/src/GMap.css +20 -20
- package/src/GMap.ts +880 -880
- package/src/GMapCounties.ts +93 -93
- package/src/GMapGraph.ts +61 -61
- package/src/GMapHeat.ts +27 -27
- package/src/GMapLayered.ts +94 -94
- package/src/GMapPin.ts +115 -115
- package/src/GMapPinLine.ts +138 -138
- package/src/GeoHash.css +14 -14
- package/src/GeoHash.ts +139 -139
- package/src/Graph.css +9 -9
- package/src/Graph.ts +98 -98
- package/src/Graticule.css +12 -12
- package/src/Graticule.ts +97 -97
- package/src/Heat.ts +87 -87
- package/src/IChoropleth.ts +8 -8
- package/src/Layer.ts +99 -99
- package/src/Layered.css +18 -18
- package/src/Layered.ts +206 -206
- package/src/Lines.css +8 -8
- package/src/Lines.ts +78 -78
- package/src/OpenStreet.css +15 -15
- package/src/OpenStreet.ts +126 -126
- package/src/Pins.css +17 -17
- package/src/Pins.ts +350 -350
- package/src/Projection.ts +42 -42
- package/src/TestHeatMap.ts +8 -8
- package/src/TopoJSONChoropleth.ts +125 -125
- package/src/Utility.ts +484 -484
- package/src/__package__.ts +3 -3
- package/src/index.ts +33 -33
- package/src/leaflet/AlbersPR.ts +48 -48
- package/src/leaflet/Blank.ts +9 -9
- package/src/leaflet/Circles.ts +139 -139
- package/src/leaflet/ClusterCircles.css +26 -26
- package/src/leaflet/ClusterCircles.ts +88 -88
- package/src/leaflet/Countries.ts +43 -43
- package/src/leaflet/DrawLayer.ts +167 -167
- package/src/leaflet/FeatureLayer.ts +138 -138
- package/src/leaflet/GMap.ts +44 -44
- package/src/leaflet/HeatLayer.ts +77 -77
- package/src/leaflet/Icons.ts +60 -60
- package/src/leaflet/Leaflet.css +3 -3
- package/src/leaflet/Leaflet.ts +239 -239
- package/src/leaflet/MapBox.ts +35 -35
- package/src/leaflet/Markers.ts +109 -109
- package/src/leaflet/OpenStreet.ts +27 -27
- package/src/leaflet/Path.ts +138 -138
- package/src/leaflet/Pins.ts +73 -73
- package/src/leaflet/Polygons.ts +113 -113
- package/src/leaflet/Region.ts +138 -138
- package/src/leaflet/Text.ts +99 -99
- package/src/leaflet/TileLayer.ts +81 -81
- package/src/leaflet/TopoJSON.ts +146 -146
- package/src/leaflet/US.ts +15 -15
- package/src/leaflet/USCounties.ts +43 -43
- package/src/leaflet/USStates.ts +41 -41
- package/src/leaflet/World.css +3 -3
- package/src/leaflet/World.ts +172 -172
- package/src/leaflet/index.ts +18 -18
- package/src/leaflet/leaflet-shim.ts +18 -18
- package/src/leaflet/plugins/BeautifyIcon.css +44 -44
- package/src/leaflet/plugins/BeautifyIcon.ts +190 -190
- package/src/leaflet/plugins/BeutifyIcon.licence +20 -20
- package/src/leaflet/plugins/D3SvgOverlay.css +2 -2
- package/src/leaflet/plugins/D3SvgOverlay.licence +20 -20
- package/src/leaflet/plugins/D3SvgOverlay.ts +175 -175
- package/src/leaflet/plugins/HeatLayer.license +21 -21
- package/src/leaflet/plugins/HeatLayer.ts +224 -224
- package/src/leaflet/plugins/Leaflet.GoogleMutant.ts +424 -424
- package/src/leaflet/plugins/lru_map.ts +352 -352
- package/src/test.ts +114 -114
- package/types/Layered.d.ts +1 -1
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import { HTMLWidget, select as d3Select, Utility } from "@hpcc-js/common";
|
|
2
|
-
import { D3SvgOverlay, FeatureGroup, LatLngBounds, LeafletEvent, Map, MarkerClusterGroup } from "./leaflet-shim.ts";
|
|
3
|
-
import { Leaflet } from "./Leaflet.ts";
|
|
4
|
-
import { ILayer } from "./TileLayer.ts";
|
|
5
|
-
|
|
6
|
-
export class FeatureLayer extends Leaflet implements ILayer {
|
|
7
|
-
protected _layer: FeatureGroup | MarkerClusterGroup;
|
|
8
|
-
protected _selection: Utility.SimpleSelection;
|
|
9
|
-
|
|
10
|
-
constructor(cluster = false) {
|
|
11
|
-
super();
|
|
12
|
-
this._layer = cluster ? new MarkerClusterGroup() : new FeatureGroup();
|
|
13
|
-
(this._layer as any).__hpcc_layer = this;
|
|
14
|
-
Utility.SimpleSelectionMixin.call(this);
|
|
15
|
-
this.layers([this]);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Enable propertyArray support ---
|
|
19
|
-
owner(_: HTMLWidget) {
|
|
20
|
-
this._owner = _;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
valid() {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
clear() {
|
|
28
|
-
this._layer.clearLayers();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
add(layer) {
|
|
32
|
-
this._layer.addLayer(layer);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
maxZoom() {
|
|
36
|
-
return (this._owner as any)._leafletMap.getMaxZoom() || 24;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
zoom() {
|
|
40
|
-
return (this._owner as any)._leafletMap.getZoom();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
visibleBounds() {
|
|
44
|
-
return (this._owner as any)._leafletMap.getBounds();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ILayer ---
|
|
48
|
-
protected _initPromise;
|
|
49
|
-
init(): Promise<void> {
|
|
50
|
-
if (!this._initPromise) {
|
|
51
|
-
this._initPromise = Promise.resolve();
|
|
52
|
-
}
|
|
53
|
-
return this._initPromise;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
hasBounds(): boolean {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getBounds(): LatLngBounds {
|
|
61
|
-
return this._layer.getBounds();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
style(id: string, _?: number | string | boolean): this | number | string | boolean {
|
|
65
|
-
if (_ === void 0) return d3Select(this._layer.getPane()).style(id);
|
|
66
|
-
d3Select(this._layer.getPane()).style(id, _);
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
protected propValue(colIdx, row, defaultValue) {
|
|
71
|
-
return (colIdx < 0 ? defaultValue : row[colIdx]) || defaultValue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
layerEnter(map: Map) {
|
|
75
|
-
map.addLayer(this._layer);
|
|
76
|
-
const elem = d3Select(map.getContainer()).select(".leaflet-pane.leaflet-marker-pane");
|
|
77
|
-
this._selection.widgetElement(elem);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
layerUpdate(map: Map) {
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
layerExit(map: Map) {
|
|
84
|
-
this._layer.clearLayers();
|
|
85
|
-
map.removeLayer(this._layer);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Events ---
|
|
89
|
-
zoomEnd(e: LeafletEvent) {
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
moveEnd(e: LeafletEvent) {
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
viewReset(e: LeafletEvent) {
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
FeatureLayer.prototype._class += " map_FeatureLayer";
|
|
100
|
-
FeatureLayer.prototype.mixin(Utility.SimpleSelectionMixin);
|
|
101
|
-
FeatureLayer.prototype.publishReset(["layers"]);
|
|
102
|
-
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
export class ClusterLayer extends FeatureLayer {
|
|
105
|
-
|
|
106
|
-
constructor(cluster = true) {
|
|
107
|
-
super(cluster);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
ClusterLayer.prototype._class += " map_ClusterLayer";
|
|
111
|
-
|
|
112
|
-
// ---------------------------------------------------------------------------
|
|
113
|
-
export class D3SurfaceLayer extends FeatureLayer {
|
|
114
|
-
|
|
115
|
-
protected _lfd3 = new D3SvgOverlay()
|
|
116
|
-
.drawCallback((selection, projection) => this.layerUpdate(undefined, projection));
|
|
117
|
-
|
|
118
|
-
hasBounds(): boolean {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
getBounds() {
|
|
123
|
-
return this._lfd3.getBounds();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
layerEnter(map: Map) {
|
|
127
|
-
super.layerEnter(map);
|
|
128
|
-
this.add(this._lfd3);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
layerUpdate(map: Map, projection?) {
|
|
132
|
-
super.layerUpdate(map);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Events ---
|
|
136
|
-
clickHandler(e, row) {
|
|
137
|
-
}
|
|
138
|
-
}
|
|
1
|
+
import { HTMLWidget, select as d3Select, Utility } from "@hpcc-js/common";
|
|
2
|
+
import { D3SvgOverlay, FeatureGroup, LatLngBounds, LeafletEvent, Map, MarkerClusterGroup } from "./leaflet-shim.ts";
|
|
3
|
+
import { Leaflet } from "./Leaflet.ts";
|
|
4
|
+
import { ILayer } from "./TileLayer.ts";
|
|
5
|
+
|
|
6
|
+
export class FeatureLayer extends Leaflet implements ILayer {
|
|
7
|
+
protected _layer: FeatureGroup | MarkerClusterGroup;
|
|
8
|
+
protected _selection: Utility.SimpleSelection;
|
|
9
|
+
|
|
10
|
+
constructor(cluster = false) {
|
|
11
|
+
super();
|
|
12
|
+
this._layer = cluster ? new MarkerClusterGroup() : new FeatureGroup();
|
|
13
|
+
(this._layer as any).__hpcc_layer = this;
|
|
14
|
+
Utility.SimpleSelectionMixin.call(this);
|
|
15
|
+
this.layers([this]);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Enable propertyArray support ---
|
|
19
|
+
owner(_: HTMLWidget) {
|
|
20
|
+
this._owner = _;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
valid() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
clear() {
|
|
28
|
+
this._layer.clearLayers();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
add(layer) {
|
|
32
|
+
this._layer.addLayer(layer);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
maxZoom() {
|
|
36
|
+
return (this._owner as any)._leafletMap.getMaxZoom() || 24;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
zoom() {
|
|
40
|
+
return (this._owner as any)._leafletMap.getZoom();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
visibleBounds() {
|
|
44
|
+
return (this._owner as any)._leafletMap.getBounds();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ILayer ---
|
|
48
|
+
protected _initPromise;
|
|
49
|
+
init(): Promise<void> {
|
|
50
|
+
if (!this._initPromise) {
|
|
51
|
+
this._initPromise = Promise.resolve();
|
|
52
|
+
}
|
|
53
|
+
return this._initPromise;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
hasBounds(): boolean {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getBounds(): LatLngBounds {
|
|
61
|
+
return this._layer.getBounds();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
style(id: string, _?: number | string | boolean): this | number | string | boolean {
|
|
65
|
+
if (_ === void 0) return d3Select(this._layer.getPane()).style(id);
|
|
66
|
+
d3Select(this._layer.getPane()).style(id, _);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected propValue(colIdx, row, defaultValue) {
|
|
71
|
+
return (colIdx < 0 ? defaultValue : row[colIdx]) || defaultValue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
layerEnter(map: Map) {
|
|
75
|
+
map.addLayer(this._layer);
|
|
76
|
+
const elem = d3Select(map.getContainer()).select(".leaflet-pane.leaflet-marker-pane");
|
|
77
|
+
this._selection.widgetElement(elem);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
layerUpdate(map: Map) {
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
layerExit(map: Map) {
|
|
84
|
+
this._layer.clearLayers();
|
|
85
|
+
map.removeLayer(this._layer);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Events ---
|
|
89
|
+
zoomEnd(e: LeafletEvent) {
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
moveEnd(e: LeafletEvent) {
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
viewReset(e: LeafletEvent) {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
FeatureLayer.prototype._class += " map_FeatureLayer";
|
|
100
|
+
FeatureLayer.prototype.mixin(Utility.SimpleSelectionMixin);
|
|
101
|
+
FeatureLayer.prototype.publishReset(["layers"]);
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
export class ClusterLayer extends FeatureLayer {
|
|
105
|
+
|
|
106
|
+
constructor(cluster = true) {
|
|
107
|
+
super(cluster);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
ClusterLayer.prototype._class += " map_ClusterLayer";
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
export class D3SurfaceLayer extends FeatureLayer {
|
|
114
|
+
|
|
115
|
+
protected _lfd3 = new D3SvgOverlay()
|
|
116
|
+
.drawCallback((selection, projection) => this.layerUpdate(undefined, projection));
|
|
117
|
+
|
|
118
|
+
hasBounds(): boolean {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
getBounds() {
|
|
123
|
+
return this._lfd3.getBounds();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
layerEnter(map: Map) {
|
|
127
|
+
super.layerEnter(map);
|
|
128
|
+
this.add(this._lfd3);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
layerUpdate(map: Map, projection?) {
|
|
132
|
+
super.layerUpdate(map);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Events ---
|
|
136
|
+
clickHandler(e, row) {
|
|
137
|
+
}
|
|
138
|
+
}
|
package/src/leaflet/GMap.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import * as _GoogleMapsLoader from "google-maps";
|
|
2
|
-
|
|
3
|
-
import { GoogleMutant, Map } from "./leaflet-shim.ts";
|
|
4
|
-
import { requireGoogleMap } from "../GMap.ts";
|
|
5
|
-
import { TileLayer } from "./TileLayer.ts";
|
|
6
|
-
|
|
7
|
-
declare const window: any;
|
|
8
|
-
|
|
9
|
-
export class GMapLayer extends TileLayer {
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
init(): Promise<void> {
|
|
16
|
-
if (!this._initPromise) {
|
|
17
|
-
this._initPromise = requireGoogleMap();
|
|
18
|
-
}
|
|
19
|
-
return this._initPromise;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
attribution(): string {
|
|
23
|
-
return !window.__hpcc_gmap_apikey ? "DEVELOPER USE ONLY (@hpcc-js)" : "";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getMaxZoom(): number {
|
|
27
|
-
return 23;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
layerEnter(map: Map) {
|
|
31
|
-
super.layerEnter(map);
|
|
32
|
-
this.add(new GoogleMutant({
|
|
33
|
-
type: "roadmap",
|
|
34
|
-
styles: this.googleMapStyles()
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
GMapLayer.prototype._class += " map_GMapLayer";
|
|
39
|
-
export interface GMapLayer {
|
|
40
|
-
googleMapStyles(): object;
|
|
41
|
-
googleMapStyles(_: object): this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
GMapLayer.prototype.publish("googleMapStyles", {}, "object", "Styling for map colors etc", null, { tags: ["Basic"] });
|
|
1
|
+
import * as _GoogleMapsLoader from "google-maps";
|
|
2
|
+
|
|
3
|
+
import { GoogleMutant, Map } from "./leaflet-shim.ts";
|
|
4
|
+
import { requireGoogleMap } from "../GMap.ts";
|
|
5
|
+
import { TileLayer } from "./TileLayer.ts";
|
|
6
|
+
|
|
7
|
+
declare const window: any;
|
|
8
|
+
|
|
9
|
+
export class GMapLayer extends TileLayer {
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
init(): Promise<void> {
|
|
16
|
+
if (!this._initPromise) {
|
|
17
|
+
this._initPromise = requireGoogleMap();
|
|
18
|
+
}
|
|
19
|
+
return this._initPromise;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
attribution(): string {
|
|
23
|
+
return !window.__hpcc_gmap_apikey ? "DEVELOPER USE ONLY (@hpcc-js)" : "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getMaxZoom(): number {
|
|
27
|
+
return 23;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
layerEnter(map: Map) {
|
|
31
|
+
super.layerEnter(map);
|
|
32
|
+
this.add(new GoogleMutant({
|
|
33
|
+
type: "roadmap",
|
|
34
|
+
styles: this.googleMapStyles()
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
GMapLayer.prototype._class += " map_GMapLayer";
|
|
39
|
+
export interface GMapLayer {
|
|
40
|
+
googleMapStyles(): object;
|
|
41
|
+
googleMapStyles(_: object): this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
GMapLayer.prototype.publish("googleMapStyles", {}, "object", "Styling for map colors etc", null, { tags: ["Basic"] });
|
package/src/leaflet/HeatLayer.ts
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { LHeatLayer, LatLngBounds, Map } from "./leaflet-shim.ts";
|
|
2
|
-
import { FeatureLayer } from "./FeatureLayer.ts";
|
|
3
|
-
|
|
4
|
-
export class HeatLayer extends FeatureLayer {
|
|
5
|
-
|
|
6
|
-
hasBounds(): boolean {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
layerUpdate(map: Map) {
|
|
11
|
-
super.layerUpdate(map);
|
|
12
|
-
this.style("opacity", this.opacity());
|
|
13
|
-
const columns = this.columns();
|
|
14
|
-
const latIdx = this.latitudeColumn_exists() ? columns.indexOf(this.latitudeColumn()) : 0;
|
|
15
|
-
const longIdx = this.longitudeColumn_exists() ? columns.indexOf(this.longitudeColumn()) : 1;
|
|
16
|
-
const weightIdx = columns.indexOf(this.weightColumn());
|
|
17
|
-
this.clear();
|
|
18
|
-
let bounds: LatLngBounds;
|
|
19
|
-
const data = this.data().filter(row => !this.omitNullLatLong() || (!!row[latIdx] && !!row[longIdx])).map(row => {
|
|
20
|
-
if (!bounds) {
|
|
21
|
-
bounds = new LatLngBounds([row[latIdx], row[longIdx]]);
|
|
22
|
-
} else {
|
|
23
|
-
bounds.extend([row[latIdx], row[longIdx]]);
|
|
24
|
-
}
|
|
25
|
-
return [row[latIdx], row[longIdx], this.weightColumn_exists() ? row[weightIdx] : 0.5];
|
|
26
|
-
});
|
|
27
|
-
const heat = new LHeatLayer(data, {
|
|
28
|
-
minOpacity: this.minOpacity(),
|
|
29
|
-
max: this.max(),
|
|
30
|
-
radius: this.radius(),
|
|
31
|
-
blur: this.blur(),
|
|
32
|
-
gradient: this.gradient() as any
|
|
33
|
-
});
|
|
34
|
-
(heat as any).getBounds = () => {
|
|
35
|
-
return bounds;
|
|
36
|
-
};
|
|
37
|
-
this.add(heat);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
HeatLayer.prototype._class += " map_Heat";
|
|
41
|
-
|
|
42
|
-
export interface HeatLayer {
|
|
43
|
-
latitudeColumn(): string;
|
|
44
|
-
latitudeColumn(_: string);
|
|
45
|
-
latitudeColumn_exists(): boolean;
|
|
46
|
-
longitudeColumn(): string;
|
|
47
|
-
longitudeColumn(_: string);
|
|
48
|
-
longitudeColumn_exists(): boolean;
|
|
49
|
-
weightColumn(): string;
|
|
50
|
-
weightColumn(_: string);
|
|
51
|
-
weightColumn_exists(): boolean;
|
|
52
|
-
omitNullLatLong(): boolean;
|
|
53
|
-
omitNullLatLong(_: boolean);
|
|
54
|
-
opacity(): number;
|
|
55
|
-
opacity(_: number);
|
|
56
|
-
minOpacity(): number;
|
|
57
|
-
minOpacity(_: number);
|
|
58
|
-
max(): number;
|
|
59
|
-
max(_: number);
|
|
60
|
-
radius(): number;
|
|
61
|
-
radius(_: number);
|
|
62
|
-
blur(): number;
|
|
63
|
-
blur(_: number);
|
|
64
|
-
gradient(): object;
|
|
65
|
-
gradient(_: object);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
HeatLayer.prototype.publish("latitudeColumn", null, "set", "Latitude column", function () { return this.columns(); }, { optional: true });
|
|
69
|
-
HeatLayer.prototype.publish("longitudeColumn", null, "set", "Longitude column", function () { return this.columns(); }, { optional: true });
|
|
70
|
-
HeatLayer.prototype.publish("weightColumn", null, "set", "Optional normalized intensity (0 -> 1) ", function () { return this.columns(); }, { optional: true });
|
|
71
|
-
HeatLayer.prototype.publish("omitNullLatLong", true, "boolean", "Remove lat=0,lng=0 from IconsData", null, { tags: ["Basic"] });
|
|
72
|
-
HeatLayer.prototype.publish("opacity", 0.5, "number", "Layer Opacity");
|
|
73
|
-
HeatLayer.prototype.publish("minOpacity", 0.5, "number", "The minimum opacity the heat will start at", null, { tags: ["Basic"] });
|
|
74
|
-
HeatLayer.prototype.publish("max", 1, "number", "maximum point intensity, 1.0 by default", null, { tags: ["Basic"] });
|
|
75
|
-
HeatLayer.prototype.publish("radius", 25, "number", "radius of each point of the heatmap, 25 by default", null, { tags: ["Basic"] });
|
|
76
|
-
HeatLayer.prototype.publish("blur", 15, "number", "amount of blur, 15 by default", null, { tags: ["Basic"] });
|
|
77
|
-
HeatLayer.prototype.publish("gradient", null, "object", "color gradient config", null, { tags: ["Basic"], optional: true });
|
|
1
|
+
import { LHeatLayer, LatLngBounds, Map } from "./leaflet-shim.ts";
|
|
2
|
+
import { FeatureLayer } from "./FeatureLayer.ts";
|
|
3
|
+
|
|
4
|
+
export class HeatLayer extends FeatureLayer {
|
|
5
|
+
|
|
6
|
+
hasBounds(): boolean {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
layerUpdate(map: Map) {
|
|
11
|
+
super.layerUpdate(map);
|
|
12
|
+
this.style("opacity", this.opacity());
|
|
13
|
+
const columns = this.columns();
|
|
14
|
+
const latIdx = this.latitudeColumn_exists() ? columns.indexOf(this.latitudeColumn()) : 0;
|
|
15
|
+
const longIdx = this.longitudeColumn_exists() ? columns.indexOf(this.longitudeColumn()) : 1;
|
|
16
|
+
const weightIdx = columns.indexOf(this.weightColumn());
|
|
17
|
+
this.clear();
|
|
18
|
+
let bounds: LatLngBounds;
|
|
19
|
+
const data = this.data().filter(row => !this.omitNullLatLong() || (!!row[latIdx] && !!row[longIdx])).map(row => {
|
|
20
|
+
if (!bounds) {
|
|
21
|
+
bounds = new LatLngBounds([row[latIdx], row[longIdx]]);
|
|
22
|
+
} else {
|
|
23
|
+
bounds.extend([row[latIdx], row[longIdx]]);
|
|
24
|
+
}
|
|
25
|
+
return [row[latIdx], row[longIdx], this.weightColumn_exists() ? row[weightIdx] : 0.5];
|
|
26
|
+
});
|
|
27
|
+
const heat = new LHeatLayer(data, {
|
|
28
|
+
minOpacity: this.minOpacity(),
|
|
29
|
+
max: this.max(),
|
|
30
|
+
radius: this.radius(),
|
|
31
|
+
blur: this.blur(),
|
|
32
|
+
gradient: this.gradient() as any
|
|
33
|
+
});
|
|
34
|
+
(heat as any).getBounds = () => {
|
|
35
|
+
return bounds;
|
|
36
|
+
};
|
|
37
|
+
this.add(heat);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
HeatLayer.prototype._class += " map_Heat";
|
|
41
|
+
|
|
42
|
+
export interface HeatLayer {
|
|
43
|
+
latitudeColumn(): string;
|
|
44
|
+
latitudeColumn(_: string);
|
|
45
|
+
latitudeColumn_exists(): boolean;
|
|
46
|
+
longitudeColumn(): string;
|
|
47
|
+
longitudeColumn(_: string);
|
|
48
|
+
longitudeColumn_exists(): boolean;
|
|
49
|
+
weightColumn(): string;
|
|
50
|
+
weightColumn(_: string);
|
|
51
|
+
weightColumn_exists(): boolean;
|
|
52
|
+
omitNullLatLong(): boolean;
|
|
53
|
+
omitNullLatLong(_: boolean);
|
|
54
|
+
opacity(): number;
|
|
55
|
+
opacity(_: number);
|
|
56
|
+
minOpacity(): number;
|
|
57
|
+
minOpacity(_: number);
|
|
58
|
+
max(): number;
|
|
59
|
+
max(_: number);
|
|
60
|
+
radius(): number;
|
|
61
|
+
radius(_: number);
|
|
62
|
+
blur(): number;
|
|
63
|
+
blur(_: number);
|
|
64
|
+
gradient(): object;
|
|
65
|
+
gradient(_: object);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
HeatLayer.prototype.publish("latitudeColumn", null, "set", "Latitude column", function () { return this.columns(); }, { optional: true });
|
|
69
|
+
HeatLayer.prototype.publish("longitudeColumn", null, "set", "Longitude column", function () { return this.columns(); }, { optional: true });
|
|
70
|
+
HeatLayer.prototype.publish("weightColumn", null, "set", "Optional normalized intensity (0 -> 1) ", function () { return this.columns(); }, { optional: true });
|
|
71
|
+
HeatLayer.prototype.publish("omitNullLatLong", true, "boolean", "Remove lat=0,lng=0 from IconsData", null, { tags: ["Basic"] });
|
|
72
|
+
HeatLayer.prototype.publish("opacity", 0.5, "number", "Layer Opacity");
|
|
73
|
+
HeatLayer.prototype.publish("minOpacity", 0.5, "number", "The minimum opacity the heat will start at", null, { tags: ["Basic"] });
|
|
74
|
+
HeatLayer.prototype.publish("max", 1, "number", "maximum point intensity, 1.0 by default", null, { tags: ["Basic"] });
|
|
75
|
+
HeatLayer.prototype.publish("radius", 25, "number", "radius of each point of the heatmap, 25 by default", null, { tags: ["Basic"] });
|
|
76
|
+
HeatLayer.prototype.publish("blur", 15, "number", "amount of blur, 15 by default", null, { tags: ["Basic"] });
|
|
77
|
+
HeatLayer.prototype.publish("gradient", null, "object", "color gradient config", null, { tags: ["Basic"], optional: true });
|
package/src/leaflet/Icons.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { Icon, Map } from "./leaflet-shim.ts";
|
|
2
|
-
import { Markers } from "./Markers.ts";
|
|
3
|
-
|
|
4
|
-
export class Icons extends Markers {
|
|
5
|
-
|
|
6
|
-
constructor(cluster = false) {
|
|
7
|
-
super(cluster);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
layerUpdate(map: Map) {
|
|
11
|
-
const columns = this.columns();
|
|
12
|
-
const iconUrlIdx = columns.indexOf(this.iconUrlColumn());
|
|
13
|
-
super.layerUpdate(map, (row) => {
|
|
14
|
-
return {
|
|
15
|
-
icon: new Icon({
|
|
16
|
-
iconUrl: this.propValue(iconUrlIdx, row, this.iconUrl()),
|
|
17
|
-
iconSize: [this.iconWidth(), this.iconHeight()],
|
|
18
|
-
iconAnchor: [this.iconAnchorX(), this.iconAnchorY()],
|
|
19
|
-
props: {
|
|
20
|
-
owner: this,
|
|
21
|
-
row
|
|
22
|
-
}
|
|
23
|
-
}),
|
|
24
|
-
draggable: false
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
Icons.prototype._class += " map_Icons";
|
|
30
|
-
|
|
31
|
-
export interface Icons {
|
|
32
|
-
iconUrl(): string;
|
|
33
|
-
iconUrl(_: string);
|
|
34
|
-
iconUrl_exists(): boolean;
|
|
35
|
-
iconUrlColumn(): string;
|
|
36
|
-
iconUrlColumn(_: string);
|
|
37
|
-
iconUrlColumn_exists(): boolean;
|
|
38
|
-
iconWidth(): number;
|
|
39
|
-
iconWidth(_: number);
|
|
40
|
-
iconHeight(): number;
|
|
41
|
-
iconHeight(_: number);
|
|
42
|
-
iconAnchorX(): number;
|
|
43
|
-
iconAnchorX(_: number);
|
|
44
|
-
iconAnchorY(): number;
|
|
45
|
-
iconAnchorY(_: number);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Icons.prototype.publish("iconUrl", "", "string", "Icon URL", null);
|
|
49
|
-
Icons.prototype.publish("iconUrlColumn", null, "set", "Icon URL column", function () { return this.columns(); }, { optional: true });
|
|
50
|
-
Icons.prototype.publish("iconWidth", 32, "number", "Icon width");
|
|
51
|
-
Icons.prototype.publish("iconHeight", 32, "number", "Icon height");
|
|
52
|
-
Icons.prototype.publish("iconAnchorX", 16, "number", "Icon Anchor X");
|
|
53
|
-
Icons.prototype.publish("iconAnchorY", 32, "number", "Icon Anchor Y");
|
|
54
|
-
|
|
55
|
-
export class ClusterIcons extends Icons {
|
|
56
|
-
constructor() {
|
|
57
|
-
super(true);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
ClusterIcons.prototype._class += " map_ClusterIcons";
|
|
1
|
+
import { Icon, Map } from "./leaflet-shim.ts";
|
|
2
|
+
import { Markers } from "./Markers.ts";
|
|
3
|
+
|
|
4
|
+
export class Icons extends Markers {
|
|
5
|
+
|
|
6
|
+
constructor(cluster = false) {
|
|
7
|
+
super(cluster);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
layerUpdate(map: Map) {
|
|
11
|
+
const columns = this.columns();
|
|
12
|
+
const iconUrlIdx = columns.indexOf(this.iconUrlColumn());
|
|
13
|
+
super.layerUpdate(map, (row) => {
|
|
14
|
+
return {
|
|
15
|
+
icon: new Icon({
|
|
16
|
+
iconUrl: this.propValue(iconUrlIdx, row, this.iconUrl()),
|
|
17
|
+
iconSize: [this.iconWidth(), this.iconHeight()],
|
|
18
|
+
iconAnchor: [this.iconAnchorX(), this.iconAnchorY()],
|
|
19
|
+
props: {
|
|
20
|
+
owner: this,
|
|
21
|
+
row
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
draggable: false
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
Icons.prototype._class += " map_Icons";
|
|
30
|
+
|
|
31
|
+
export interface Icons {
|
|
32
|
+
iconUrl(): string;
|
|
33
|
+
iconUrl(_: string);
|
|
34
|
+
iconUrl_exists(): boolean;
|
|
35
|
+
iconUrlColumn(): string;
|
|
36
|
+
iconUrlColumn(_: string);
|
|
37
|
+
iconUrlColumn_exists(): boolean;
|
|
38
|
+
iconWidth(): number;
|
|
39
|
+
iconWidth(_: number);
|
|
40
|
+
iconHeight(): number;
|
|
41
|
+
iconHeight(_: number);
|
|
42
|
+
iconAnchorX(): number;
|
|
43
|
+
iconAnchorX(_: number);
|
|
44
|
+
iconAnchorY(): number;
|
|
45
|
+
iconAnchorY(_: number);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Icons.prototype.publish("iconUrl", "", "string", "Icon URL", null);
|
|
49
|
+
Icons.prototype.publish("iconUrlColumn", null, "set", "Icon URL column", function () { return this.columns(); }, { optional: true });
|
|
50
|
+
Icons.prototype.publish("iconWidth", 32, "number", "Icon width");
|
|
51
|
+
Icons.prototype.publish("iconHeight", 32, "number", "Icon height");
|
|
52
|
+
Icons.prototype.publish("iconAnchorX", 16, "number", "Icon Anchor X");
|
|
53
|
+
Icons.prototype.publish("iconAnchorY", 32, "number", "Icon Anchor Y");
|
|
54
|
+
|
|
55
|
+
export class ClusterIcons extends Icons {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(true);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
ClusterIcons.prototype._class += " map_ClusterIcons";
|
package/src/leaflet/Leaflet.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.map_Leaflet .leaflet-container {
|
|
2
|
-
background-color: rgba(255, 0, 0, 0.0);
|
|
3
|
-
background: rgba(255, 0, 0, 0.0);
|
|
1
|
+
.map_Leaflet .leaflet-container {
|
|
2
|
+
background-color: rgba(255, 0, 0, 0.0);
|
|
3
|
+
background: rgba(255, 0, 0, 0.0);
|
|
4
4
|
}
|