@hpcc-js/map 3.5.4 → 3.5.5

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.
Files changed (95) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +88 -88
  3. package/TopoJSON/BR.json +122 -122
  4. package/TopoJSON/GB_idx.json +1 -1
  5. package/TopoJSON/IE_idx.json +1 -1
  6. package/TopoJSON/ND_idx.json +1 -1
  7. package/TopoJSON/countries.json +257 -257
  8. package/TopoJSON/us-counties.json +16550 -16550
  9. package/TopoJSON/us-states.json +458 -458
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.umd.cjs +1 -1
  13. package/dist/index.umd.cjs.map +1 -1
  14. package/package.json +8 -8
  15. package/src/CanvasPinLayer.ts +99 -99
  16. package/src/CanvasPins.ts +397 -397
  17. package/src/Choropleth.css +26 -26
  18. package/src/Choropleth.ts +203 -203
  19. package/src/ChoroplethContinents.ts +13 -13
  20. package/src/ChoroplethCounties.ts +111 -111
  21. package/src/ChoroplethCountries.ts +100 -100
  22. package/src/ChoroplethStates.ts +103 -103
  23. package/src/ChoroplethStatesHeat.ts +8 -8
  24. package/src/GMap.css +20 -20
  25. package/src/GMap.ts +880 -880
  26. package/src/GMapCounties.ts +93 -93
  27. package/src/GMapGraph.ts +61 -61
  28. package/src/GMapHeat.ts +27 -27
  29. package/src/GMapLayered.ts +94 -94
  30. package/src/GMapPin.ts +115 -115
  31. package/src/GMapPinLine.ts +138 -138
  32. package/src/GeoHash.css +14 -14
  33. package/src/GeoHash.ts +139 -139
  34. package/src/Graph.css +9 -9
  35. package/src/Graph.ts +98 -98
  36. package/src/Graticule.css +12 -12
  37. package/src/Graticule.ts +97 -97
  38. package/src/Heat.ts +87 -87
  39. package/src/IChoropleth.ts +8 -8
  40. package/src/Layer.ts +99 -99
  41. package/src/Layered.css +18 -18
  42. package/src/Layered.ts +206 -206
  43. package/src/Lines.css +8 -8
  44. package/src/Lines.ts +78 -78
  45. package/src/OpenStreet.css +15 -15
  46. package/src/OpenStreet.ts +126 -126
  47. package/src/Pins.css +17 -17
  48. package/src/Pins.ts +350 -350
  49. package/src/Projection.ts +42 -42
  50. package/src/TestHeatMap.ts +8 -8
  51. package/src/TopoJSONChoropleth.ts +125 -125
  52. package/src/Utility.ts +484 -484
  53. package/src/__package__.ts +3 -3
  54. package/src/index.ts +33 -33
  55. package/src/leaflet/AlbersPR.ts +48 -48
  56. package/src/leaflet/Blank.ts +9 -9
  57. package/src/leaflet/Circles.ts +139 -139
  58. package/src/leaflet/ClusterCircles.css +26 -26
  59. package/src/leaflet/ClusterCircles.ts +88 -88
  60. package/src/leaflet/Countries.ts +43 -43
  61. package/src/leaflet/DrawLayer.ts +167 -167
  62. package/src/leaflet/FeatureLayer.ts +138 -138
  63. package/src/leaflet/GMap.ts +44 -44
  64. package/src/leaflet/HeatLayer.ts +77 -77
  65. package/src/leaflet/Icons.ts +60 -60
  66. package/src/leaflet/Leaflet.css +3 -3
  67. package/src/leaflet/Leaflet.ts +239 -239
  68. package/src/leaflet/MapBox.ts +35 -35
  69. package/src/leaflet/Markers.ts +109 -109
  70. package/src/leaflet/OpenStreet.ts +27 -27
  71. package/src/leaflet/Path.ts +138 -138
  72. package/src/leaflet/Pins.ts +73 -73
  73. package/src/leaflet/Polygons.ts +113 -113
  74. package/src/leaflet/Region.ts +138 -138
  75. package/src/leaflet/Text.ts +99 -99
  76. package/src/leaflet/TileLayer.ts +81 -81
  77. package/src/leaflet/TopoJSON.ts +146 -146
  78. package/src/leaflet/US.ts +15 -15
  79. package/src/leaflet/USCounties.ts +43 -43
  80. package/src/leaflet/USStates.ts +41 -41
  81. package/src/leaflet/World.css +3 -3
  82. package/src/leaflet/World.ts +172 -172
  83. package/src/leaflet/index.ts +18 -18
  84. package/src/leaflet/leaflet-shim.ts +18 -18
  85. package/src/leaflet/plugins/BeautifyIcon.css +44 -44
  86. package/src/leaflet/plugins/BeautifyIcon.ts +190 -190
  87. package/src/leaflet/plugins/BeutifyIcon.licence +20 -20
  88. package/src/leaflet/plugins/D3SvgOverlay.css +2 -2
  89. package/src/leaflet/plugins/D3SvgOverlay.licence +20 -20
  90. package/src/leaflet/plugins/D3SvgOverlay.ts +175 -175
  91. package/src/leaflet/plugins/HeatLayer.license +21 -21
  92. package/src/leaflet/plugins/HeatLayer.ts +224 -224
  93. package/src/leaflet/plugins/Leaflet.GoogleMutant.ts +424 -424
  94. package/src/leaflet/plugins/lru_map.ts +352 -352
  95. package/src/test.ts +114 -114
package/src/GeoHash.ts CHANGED
@@ -1,139 +1,139 @@
1
- import { Palette, Utility as CommonUtility } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
- import { Layer } from "./Layer.ts";
4
- import * as Utility from "./Utility.ts";
5
-
6
- import "../src/GeoHash.css";
7
-
8
- export class GeoHash extends Layer {
9
- _dataMinWeight;
10
- _dataMaxWeight;
11
- geohash;
12
- _geoHashTransform;
13
- geoHashPaths;
14
-
15
- constructor() {
16
- super();
17
- }
18
-
19
- data(_?) {
20
- const retVal = Layer.prototype.data.apply(this, arguments);
21
- if (arguments.length) {
22
- this._dataMinWeight = null;
23
- this._dataMaxWeight = null;
24
-
25
- this.data().forEach(function (item) {
26
- if (!this._dataMinWeight || item[1] < this._dataMinWeight) {
27
- this._dataMinWeight = item[1];
28
- }
29
- if (!this._dataMaxWeight || item[1] > this._dataMaxWeight) {
30
- this._dataMaxWeight = item[1];
31
- }
32
- }, this);
33
- }
34
- return retVal;
35
- }
36
-
37
- layerEnter(base, svgElement, domElement) {
38
- Layer.prototype.layerEnter.apply(this, arguments);
39
-
40
- this.geohash = new Utility.Geohash();
41
- this._geoHashTransform = svgElement
42
- .append("g")
43
- .attr("class", "map_GeoHash")
44
- ;
45
- this._selection = new CommonUtility.SimpleSelection(this, this._geoHashTransform);
46
- this.geoHashPaths = d3Select(null);
47
- }
48
-
49
- layerUpdate(base) {
50
- Layer.prototype.layerUpdate.apply(this, arguments);
51
-
52
- this._palette = this._palette.switch(this.paletteID());
53
- if (this.useClonedPalette()) {
54
- this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
55
- }
56
-
57
- this._geoHashTransform.style("opacity", this.opacity());
58
-
59
- this.geoHashPaths = this._geoHashTransform.selectAll(".data").data(this.visible() ? this.data() : [], function (d) { return d[0]; });
60
- const context = this;
61
- this.geoHashPaths.enter().append("path")
62
- .attr("class", "data")
63
- .call(this._selection.enter.bind(this._selection))
64
- .on("click", function (d) {
65
- context.click(context.rowToObj(d), "weight", context._selection.selected(this));
66
- })
67
- .on("dblclick", function (d) {
68
- context.dblclick(context.rowToObj(d), "weight", context._selection.selected(this));
69
- })
70
- .merge(this.geoHashPaths)
71
- .attr("d", function (d) {
72
- const pos = context.geohash.bounds(d[0]);
73
- const route = {
74
- type: "LineString",
75
- coordinates: [
76
- [pos.sw.lon, pos.ne.lat],
77
- [pos.ne.lon, pos.ne.lat],
78
- [pos.ne.lon, pos.sw.lat],
79
- [pos.sw.lon, pos.sw.lat]
80
- ]
81
- };
82
- return base._d3GeoPath(route);
83
- })
84
- .style("fill", function (d) {
85
- const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
86
- return retVal;
87
- })
88
- ;
89
- this.geoHashPaths.exit().remove();
90
- }
91
-
92
- // Events ---
93
- click(row, column, selected) {
94
- }
95
-
96
- dblclick(row, column, selected) {
97
- }
98
- }
99
- GeoHash.prototype._class += " map_GeoHash";
100
-
101
- GeoHash.prototype._palette = Palette.rainbow("default");
102
-
103
- export interface GeoHash {
104
- _palette;
105
-
106
- // Simple Selection ---
107
- _selection;
108
-
109
- // Properties ---
110
- paletteID(): string;
111
- paletteID(_: string): this;
112
- paletteID_exists(): boolean;
113
- useClonedPalette(): boolean;
114
- useClonedPalette(_: boolean): this;
115
- useClonedPalette_exists(): boolean;
116
-
117
- opacity(): number;
118
- opacity(_: number): this;
119
- opacity_exists(): boolean;
120
-
121
- meshVisible(): boolean;
122
- meshVisible(_: boolean): this;
123
- meshVisible_exists(): boolean;
124
- meshColor(): string;
125
- meshColor(_: string): this;
126
- meshColor_exists(): boolean;
127
- meshStrokeWidth(): number;
128
- meshStrokeWidth(_: number): this;
129
- meshStrokeWidth_exists(): boolean;
130
- }
131
-
132
- GeoHash.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", GeoHash.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
133
- GeoHash.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
134
-
135
- GeoHash.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
136
-
137
- GeoHash.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
138
- GeoHash.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
139
- GeoHash.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
1
+ import { Palette, Utility as CommonUtility } from "@hpcc-js/common";
2
+ import { select as d3Select } from "d3-selection";
3
+ import { Layer } from "./Layer.ts";
4
+ import * as Utility from "./Utility.ts";
5
+
6
+ import "../src/GeoHash.css";
7
+
8
+ export class GeoHash extends Layer {
9
+ _dataMinWeight;
10
+ _dataMaxWeight;
11
+ geohash;
12
+ _geoHashTransform;
13
+ geoHashPaths;
14
+
15
+ constructor() {
16
+ super();
17
+ }
18
+
19
+ data(_?) {
20
+ const retVal = Layer.prototype.data.apply(this, arguments);
21
+ if (arguments.length) {
22
+ this._dataMinWeight = null;
23
+ this._dataMaxWeight = null;
24
+
25
+ this.data().forEach(function (item) {
26
+ if (!this._dataMinWeight || item[1] < this._dataMinWeight) {
27
+ this._dataMinWeight = item[1];
28
+ }
29
+ if (!this._dataMaxWeight || item[1] > this._dataMaxWeight) {
30
+ this._dataMaxWeight = item[1];
31
+ }
32
+ }, this);
33
+ }
34
+ return retVal;
35
+ }
36
+
37
+ layerEnter(base, svgElement, domElement) {
38
+ Layer.prototype.layerEnter.apply(this, arguments);
39
+
40
+ this.geohash = new Utility.Geohash();
41
+ this._geoHashTransform = svgElement
42
+ .append("g")
43
+ .attr("class", "map_GeoHash")
44
+ ;
45
+ this._selection = new CommonUtility.SimpleSelection(this, this._geoHashTransform);
46
+ this.geoHashPaths = d3Select(null);
47
+ }
48
+
49
+ layerUpdate(base) {
50
+ Layer.prototype.layerUpdate.apply(this, arguments);
51
+
52
+ this._palette = this._palette.switch(this.paletteID());
53
+ if (this.useClonedPalette()) {
54
+ this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
55
+ }
56
+
57
+ this._geoHashTransform.style("opacity", this.opacity());
58
+
59
+ this.geoHashPaths = this._geoHashTransform.selectAll(".data").data(this.visible() ? this.data() : [], function (d) { return d[0]; });
60
+ const context = this;
61
+ this.geoHashPaths.enter().append("path")
62
+ .attr("class", "data")
63
+ .call(this._selection.enter.bind(this._selection))
64
+ .on("click", function (d) {
65
+ context.click(context.rowToObj(d), "weight", context._selection.selected(this));
66
+ })
67
+ .on("dblclick", function (d) {
68
+ context.dblclick(context.rowToObj(d), "weight", context._selection.selected(this));
69
+ })
70
+ .merge(this.geoHashPaths)
71
+ .attr("d", function (d) {
72
+ const pos = context.geohash.bounds(d[0]);
73
+ const route = {
74
+ type: "LineString",
75
+ coordinates: [
76
+ [pos.sw.lon, pos.ne.lat],
77
+ [pos.ne.lon, pos.ne.lat],
78
+ [pos.ne.lon, pos.sw.lat],
79
+ [pos.sw.lon, pos.sw.lat]
80
+ ]
81
+ };
82
+ return base._d3GeoPath(route);
83
+ })
84
+ .style("fill", function (d) {
85
+ const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
86
+ return retVal;
87
+ })
88
+ ;
89
+ this.geoHashPaths.exit().remove();
90
+ }
91
+
92
+ // Events ---
93
+ click(row, column, selected) {
94
+ }
95
+
96
+ dblclick(row, column, selected) {
97
+ }
98
+ }
99
+ GeoHash.prototype._class += " map_GeoHash";
100
+
101
+ GeoHash.prototype._palette = Palette.rainbow("default");
102
+
103
+ export interface GeoHash {
104
+ _palette;
105
+
106
+ // Simple Selection ---
107
+ _selection;
108
+
109
+ // Properties ---
110
+ paletteID(): string;
111
+ paletteID(_: string): this;
112
+ paletteID_exists(): boolean;
113
+ useClonedPalette(): boolean;
114
+ useClonedPalette(_: boolean): this;
115
+ useClonedPalette_exists(): boolean;
116
+
117
+ opacity(): number;
118
+ opacity(_: number): this;
119
+ opacity_exists(): boolean;
120
+
121
+ meshVisible(): boolean;
122
+ meshVisible(_: boolean): this;
123
+ meshVisible_exists(): boolean;
124
+ meshColor(): string;
125
+ meshColor(_: string): this;
126
+ meshColor_exists(): boolean;
127
+ meshStrokeWidth(): number;
128
+ meshStrokeWidth(_: number): this;
129
+ meshStrokeWidth_exists(): boolean;
130
+ }
131
+
132
+ GeoHash.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", GeoHash.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
133
+ GeoHash.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
134
+
135
+ GeoHash.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
136
+
137
+ GeoHash.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
138
+ GeoHash.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
139
+ GeoHash.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
package/src/Graph.css CHANGED
@@ -1,10 +1,10 @@
1
- .map_Layered .marker {
2
- fill: #656565;
3
- stroke: none;
4
- stroke-width: 1.0px;
5
- }
6
-
7
- .map_Layered .dataEdge {
8
- stroke: black;
9
- fill: none;
1
+ .map_Layered .marker {
2
+ fill: #656565;
3
+ stroke: none;
4
+ stroke-width: 1.0px;
5
+ }
6
+
7
+ .map_Layered .dataEdge {
8
+ stroke: black;
9
+ fill: none;
10
10
  }
package/src/Graph.ts CHANGED
@@ -1,98 +1,98 @@
1
- import { Pins } from "./Pins.ts";
2
-
3
- import "../src/Graph.css";
4
-
5
- export class Graph extends Pins {
6
- dataEdges = [];
7
- _edgesTransform;
8
-
9
- constructor() {
10
- super();
11
- }
12
-
13
- importJSON(_) {
14
- const retVal = Pins.prototype.importJSON.apply(this, arguments);
15
- if (arguments.length) {
16
- this.dataEdges = [];
17
- let prevPin = null;
18
- _.forEach(function (row) {
19
- if (prevPin) {
20
- this.dataEdges.push({
21
- type: "LineString",
22
- coordinates: [[prevPin.long, prevPin.lat], [row.long, row.lat]]
23
- });
24
- }
25
- if (row.eol) {
26
- prevPin = null;
27
- } else {
28
- prevPin = row;
29
- }
30
- }, this);
31
- }
32
- return retVal;
33
- }
34
-
35
- data(_) {
36
- const retVal = Pins.prototype.data.apply(this, arguments);
37
- if (arguments.length) {
38
- this.dataEdges = [];
39
- let prevPin = null;
40
- _.forEach(function (row) {
41
- if (prevPin) {
42
- this.dataEdges.push({
43
- type: "LineString",
44
- coordinates: [[prevPin[1], prevPin[0]], [row[1], row[0]]]
45
- });
46
- }
47
- prevPin = row;
48
- }, this);
49
- }
50
- return retVal;
51
- }
52
-
53
- layerEnter(base, svgElement, domElement) {
54
- Pins.prototype.layerEnter.apply(this, arguments);
55
-
56
- svgElement.append("defs").append("marker")
57
- .attr("class", "marker")
58
- .attr("id", this._id + "_arrowHead")
59
- .attr("viewBox", "0 0 10 10")
60
- .attr("refX", 10)
61
- .attr("refY", 5)
62
- .attr("markerWidth", 16)
63
- .attr("markerHeight", 16)
64
- .attr("markerUnits", "strokeWidth")
65
- .attr("orient", "auto")
66
- .append("polyline")
67
- .attr("points", "0,0 10,5 0,10 1,5")
68
- ;
69
- this._edgesTransform = svgElement.append("g");
70
- }
71
-
72
- _edgesPaths;
73
- layerUpdate(base) {
74
- Pins.prototype.layerUpdate.apply(this, arguments);
75
-
76
- this._edgesTransform
77
- .style("opacity", this.opacity())
78
- ;
79
-
80
- const edgesPaths = this._edgesTransform.selectAll(".dataEdge").data(this.visible() ? this.dataEdges : []);
81
- this._edgesPaths = edgesPaths.enter().append("path")
82
- .attr("class", "dataEdge")
83
- .attr("marker-end", "url(#" + this._id + "_arrowHead)")
84
- .merge(edgesPaths)
85
- .attr("d", base._d3GeoPath)
86
- ;
87
- edgesPaths.exit().remove();
88
- }
89
-
90
- layerZoomed(base) {
91
- Pins.prototype.layerZoomed.apply(this, arguments);
92
- this._edgesPaths
93
- .attr("stroke-width", `${0.5 / base.zoomScale()}px`)
94
- ;
95
- }
96
-
97
- }
98
- Graph.prototype._class += " map_Graph";
1
+ import { Pins } from "./Pins.ts";
2
+
3
+ import "../src/Graph.css";
4
+
5
+ export class Graph extends Pins {
6
+ dataEdges = [];
7
+ _edgesTransform;
8
+
9
+ constructor() {
10
+ super();
11
+ }
12
+
13
+ importJSON(_) {
14
+ const retVal = Pins.prototype.importJSON.apply(this, arguments);
15
+ if (arguments.length) {
16
+ this.dataEdges = [];
17
+ let prevPin = null;
18
+ _.forEach(function (row) {
19
+ if (prevPin) {
20
+ this.dataEdges.push({
21
+ type: "LineString",
22
+ coordinates: [[prevPin.long, prevPin.lat], [row.long, row.lat]]
23
+ });
24
+ }
25
+ if (row.eol) {
26
+ prevPin = null;
27
+ } else {
28
+ prevPin = row;
29
+ }
30
+ }, this);
31
+ }
32
+ return retVal;
33
+ }
34
+
35
+ data(_) {
36
+ const retVal = Pins.prototype.data.apply(this, arguments);
37
+ if (arguments.length) {
38
+ this.dataEdges = [];
39
+ let prevPin = null;
40
+ _.forEach(function (row) {
41
+ if (prevPin) {
42
+ this.dataEdges.push({
43
+ type: "LineString",
44
+ coordinates: [[prevPin[1], prevPin[0]], [row[1], row[0]]]
45
+ });
46
+ }
47
+ prevPin = row;
48
+ }, this);
49
+ }
50
+ return retVal;
51
+ }
52
+
53
+ layerEnter(base, svgElement, domElement) {
54
+ Pins.prototype.layerEnter.apply(this, arguments);
55
+
56
+ svgElement.append("defs").append("marker")
57
+ .attr("class", "marker")
58
+ .attr("id", this._id + "_arrowHead")
59
+ .attr("viewBox", "0 0 10 10")
60
+ .attr("refX", 10)
61
+ .attr("refY", 5)
62
+ .attr("markerWidth", 16)
63
+ .attr("markerHeight", 16)
64
+ .attr("markerUnits", "strokeWidth")
65
+ .attr("orient", "auto")
66
+ .append("polyline")
67
+ .attr("points", "0,0 10,5 0,10 1,5")
68
+ ;
69
+ this._edgesTransform = svgElement.append("g");
70
+ }
71
+
72
+ _edgesPaths;
73
+ layerUpdate(base) {
74
+ Pins.prototype.layerUpdate.apply(this, arguments);
75
+
76
+ this._edgesTransform
77
+ .style("opacity", this.opacity())
78
+ ;
79
+
80
+ const edgesPaths = this._edgesTransform.selectAll(".dataEdge").data(this.visible() ? this.dataEdges : []);
81
+ this._edgesPaths = edgesPaths.enter().append("path")
82
+ .attr("class", "dataEdge")
83
+ .attr("marker-end", "url(#" + this._id + "_arrowHead)")
84
+ .merge(edgesPaths)
85
+ .attr("d", base._d3GeoPath)
86
+ ;
87
+ edgesPaths.exit().remove();
88
+ }
89
+
90
+ layerZoomed(base) {
91
+ Pins.prototype.layerZoomed.apply(this, arguments);
92
+ this._edgesPaths
93
+ .attr("stroke-width", `${0.5 / base.zoomScale()}px`)
94
+ ;
95
+ }
96
+
97
+ }
98
+ Graph.prototype._class += " map_Graph";
package/src/Graticule.css CHANGED
@@ -1,13 +1,13 @@
1
- .map_Layered .graticule {
2
- fill: none;
3
- stroke: darkgray;
4
- stroke-linejoin: round;
5
- stroke-width: 0.25px;
6
- }
7
-
8
- .map_Layered .graticuleOutline {
9
- fill: none;
10
- stroke: black;
11
- stroke-linejoin: round;
12
- stroke-width: 0.25px;
1
+ .map_Layered .graticule {
2
+ fill: none;
3
+ stroke: darkgray;
4
+ stroke-linejoin: round;
5
+ stroke-width: 0.25px;
6
+ }
7
+
8
+ .map_Layered .graticuleOutline {
9
+ fill: none;
10
+ stroke: black;
11
+ stroke-linejoin: round;
12
+ stroke-width: 0.25px;
13
13
  }