@hpcc-js/map 2.79.2 → 2.79.3

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 (87) 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.es6.js +19969 -19969
  11. package/dist/index.es6.js.map +1 -1
  12. package/dist/index.js +19967 -19967
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.min.js +2 -2
  15. package/dist/index.min.js.map +1 -1
  16. package/package.json +9 -9
  17. package/src/CanvasPinLayer.ts +99 -99
  18. package/src/CanvasPins.ts +396 -396
  19. package/src/Choropleth.css +27 -27
  20. package/src/Choropleth.ts +195 -195
  21. package/src/ChoroplethContinents.ts +13 -13
  22. package/src/ChoroplethCounties.ts +109 -109
  23. package/src/ChoroplethCountries.ts +100 -100
  24. package/src/ChoroplethStates.ts +104 -104
  25. package/src/ChoroplethStatesHeat.ts +8 -8
  26. package/src/GMap.css +16 -16
  27. package/src/GMap.ts +879 -879
  28. package/src/GMapCounties.ts +93 -93
  29. package/src/GMapGraph.ts +61 -61
  30. package/src/GMapHeat.ts +27 -27
  31. package/src/GMapLayered.ts +94 -94
  32. package/src/GMapPin.ts +115 -115
  33. package/src/GMapPinLine.ts +125 -125
  34. package/src/GeoHash.css +15 -15
  35. package/src/GeoHash.ts +125 -125
  36. package/src/Graph.css +10 -10
  37. package/src/Graph.ts +98 -98
  38. package/src/Graticule.css +13 -13
  39. package/src/Graticule.ts +90 -90
  40. package/src/Heat.css +2 -2
  41. package/src/Heat.ts +82 -82
  42. package/src/IChoropleth.ts +8 -8
  43. package/src/Layer.ts +90 -90
  44. package/src/Layered.css +19 -19
  45. package/src/Layered.ts +206 -206
  46. package/src/Lines.css +9 -9
  47. package/src/Lines.ts +75 -75
  48. package/src/OpenStreet.css +15 -15
  49. package/src/OpenStreet.ts +123 -123
  50. package/src/Pins.css +18 -18
  51. package/src/Pins.ts +319 -319
  52. package/src/Projection.ts +42 -42
  53. package/src/TestHeatMap.ts +8 -8
  54. package/src/TopoJSONChoropleth.ts +114 -114
  55. package/src/Utility.ts +482 -482
  56. package/src/__package__.ts +3 -3
  57. package/src/index.ts +34 -34
  58. package/src/leaflet/AlbersPR.ts +48 -48
  59. package/src/leaflet/Blank.ts +9 -9
  60. package/src/leaflet/Circles.ts +139 -139
  61. package/src/leaflet/ClusterCircles.css +26 -26
  62. package/src/leaflet/ClusterCircles.ts +88 -88
  63. package/src/leaflet/Countries.ts +43 -43
  64. package/src/leaflet/DrawLayer.ts +167 -167
  65. package/src/leaflet/FeatureLayer.ts +138 -138
  66. package/src/leaflet/GMap.ts +44 -44
  67. package/src/leaflet/HeatLayer.ts +77 -77
  68. package/src/leaflet/Icons.ts +60 -60
  69. package/src/leaflet/Leaflet.css +3 -3
  70. package/src/leaflet/Leaflet.ts +238 -238
  71. package/src/leaflet/MapBox.ts +35 -35
  72. package/src/leaflet/Markers.ts +109 -109
  73. package/src/leaflet/OpenStreet.ts +27 -27
  74. package/src/leaflet/Path.ts +138 -138
  75. package/src/leaflet/Pins.ts +73 -73
  76. package/src/leaflet/Polygons.ts +113 -113
  77. package/src/leaflet/Region.ts +138 -138
  78. package/src/leaflet/Text.ts +99 -99
  79. package/src/leaflet/TileLayer.ts +81 -81
  80. package/src/leaflet/TopoJSON.ts +146 -146
  81. package/src/leaflet/US.ts +15 -15
  82. package/src/leaflet/USCounties.ts +43 -43
  83. package/src/leaflet/USStates.ts +41 -41
  84. package/src/leaflet/World.css +3 -3
  85. package/src/leaflet/World.ts +171 -171
  86. package/src/leaflet/index.ts +18 -18
  87. package/src/test.ts +114 -114
package/src/GeoHash.ts CHANGED
@@ -1,125 +1,125 @@
1
- import { Palette, Utility as CommonUtility } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
- import { Layer } from "./Layer";
4
- import * as Utility from "./Utility";
5
-
6
- import "../src/GeoHash.css";
7
-
8
- export class GeoHash extends Layer {
9
- _palette;
10
- _dataMinWeight;
11
- _dataMaxWeight;
12
- geohash;
13
- _geoHashTransform;
14
- _selection;
15
- geoHashPaths;
16
-
17
- constructor() {
18
- super();
19
- }
20
-
21
- data(_?) {
22
- const retVal = Layer.prototype.data.apply(this, arguments);
23
- if (arguments.length) {
24
- this._dataMinWeight = null;
25
- this._dataMaxWeight = null;
26
-
27
- this.data().forEach(function (item) {
28
- if (!this._dataMinWeight || item[1] < this._dataMinWeight) {
29
- this._dataMinWeight = item[1];
30
- }
31
- if (!this._dataMaxWeight || item[1] > this._dataMaxWeight) {
32
- this._dataMaxWeight = item[1];
33
- }
34
- }, this);
35
- }
36
- return retVal;
37
- }
38
-
39
- layerEnter(base, svgElement, domElement) {
40
- Layer.prototype.layerEnter.apply(this, arguments);
41
-
42
- this.geohash = new Utility.Geohash();
43
- this._geoHashTransform = svgElement
44
- .append("g")
45
- .attr("class", "map_GeoHash")
46
- ;
47
- this._selection = new CommonUtility.SimpleSelection(this, this._geoHashTransform);
48
- this.geoHashPaths = d3Select(null);
49
- }
50
-
51
- layerUpdate(base) {
52
- Layer.prototype.layerUpdate.apply(this, arguments);
53
-
54
- this._palette = this._palette.switch(this.paletteID());
55
- if (this.useClonedPalette()) {
56
- this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
57
- }
58
-
59
- this._geoHashTransform.style("opacity", this.opacity());
60
-
61
- this.geoHashPaths = this._geoHashTransform.selectAll(".data").data(this.visible() ? this.data() : [], function (d) { return d[0]; });
62
- const context = this;
63
- this.geoHashPaths.enter().append("path")
64
- .attr("class", "data")
65
- .call(this._selection.enter.bind(this._selection))
66
- .on("click", function (d) {
67
- context.click(context.rowToObj(d), "weight", context._selection.selected(this));
68
- })
69
- .on("dblclick", function (d) {
70
- context.dblclick(context.rowToObj(d), "weight", context._selection.selected(this));
71
- })
72
- .merge(this.geoHashPaths)
73
- .attr("d", function (d) {
74
- const pos = context.geohash.bounds(d[0]);
75
- const route = {
76
- type: "LineString",
77
- coordinates: [
78
- [pos.sw.lon, pos.ne.lat],
79
- [pos.ne.lon, pos.ne.lat],
80
- [pos.ne.lon, pos.sw.lat],
81
- [pos.sw.lon, pos.sw.lat]
82
- ]
83
- };
84
- return base._d3GeoPath(route);
85
- })
86
- .style("fill", function (d) {
87
- const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
88
- return retVal;
89
- })
90
- ;
91
- this.geoHashPaths.exit().remove();
92
- }
93
-
94
- // Events ---
95
- click(row, column, selected) {
96
- }
97
-
98
- dblclick(row, column, selected) {
99
- }
100
-
101
- paletteID: { (): string; (_: string): GeoHash };
102
- paletteID_exists: () => boolean;
103
- useClonedPalette: { (): boolean; (_: boolean): GeoHash };
104
- useClonedPalette_exists: () => boolean;
105
- opacity: { (): number; (_: number): GeoHash };
106
- opacity_exists: () => boolean;
107
- meshVisible: { (): boolean; (_: boolean): GeoHash };
108
- meshVisible_exists: () => boolean;
109
- meshColor: { (): string; (_: string): GeoHash };
110
- meshColor_exists: () => boolean;
111
- meshStrokeWidth: { (): number; (_: number): GeoHash };
112
- meshStrokeWidth_exists: () => boolean;
113
- }
114
- GeoHash.prototype._class += " map_GeoHash";
115
-
116
- GeoHash.prototype._palette = Palette.rainbow("default");
117
-
118
- GeoHash.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", GeoHash.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
119
- GeoHash.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
120
-
121
- GeoHash.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
122
-
123
- GeoHash.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
124
- GeoHash.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
125
- 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";
4
+ import * as Utility from "./Utility";
5
+
6
+ import "../src/GeoHash.css";
7
+
8
+ export class GeoHash extends Layer {
9
+ _palette;
10
+ _dataMinWeight;
11
+ _dataMaxWeight;
12
+ geohash;
13
+ _geoHashTransform;
14
+ _selection;
15
+ geoHashPaths;
16
+
17
+ constructor() {
18
+ super();
19
+ }
20
+
21
+ data(_?) {
22
+ const retVal = Layer.prototype.data.apply(this, arguments);
23
+ if (arguments.length) {
24
+ this._dataMinWeight = null;
25
+ this._dataMaxWeight = null;
26
+
27
+ this.data().forEach(function (item) {
28
+ if (!this._dataMinWeight || item[1] < this._dataMinWeight) {
29
+ this._dataMinWeight = item[1];
30
+ }
31
+ if (!this._dataMaxWeight || item[1] > this._dataMaxWeight) {
32
+ this._dataMaxWeight = item[1];
33
+ }
34
+ }, this);
35
+ }
36
+ return retVal;
37
+ }
38
+
39
+ layerEnter(base, svgElement, domElement) {
40
+ Layer.prototype.layerEnter.apply(this, arguments);
41
+
42
+ this.geohash = new Utility.Geohash();
43
+ this._geoHashTransform = svgElement
44
+ .append("g")
45
+ .attr("class", "map_GeoHash")
46
+ ;
47
+ this._selection = new CommonUtility.SimpleSelection(this, this._geoHashTransform);
48
+ this.geoHashPaths = d3Select(null);
49
+ }
50
+
51
+ layerUpdate(base) {
52
+ Layer.prototype.layerUpdate.apply(this, arguments);
53
+
54
+ this._palette = this._palette.switch(this.paletteID());
55
+ if (this.useClonedPalette()) {
56
+ this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
57
+ }
58
+
59
+ this._geoHashTransform.style("opacity", this.opacity());
60
+
61
+ this.geoHashPaths = this._geoHashTransform.selectAll(".data").data(this.visible() ? this.data() : [], function (d) { return d[0]; });
62
+ const context = this;
63
+ this.geoHashPaths.enter().append("path")
64
+ .attr("class", "data")
65
+ .call(this._selection.enter.bind(this._selection))
66
+ .on("click", function (d) {
67
+ context.click(context.rowToObj(d), "weight", context._selection.selected(this));
68
+ })
69
+ .on("dblclick", function (d) {
70
+ context.dblclick(context.rowToObj(d), "weight", context._selection.selected(this));
71
+ })
72
+ .merge(this.geoHashPaths)
73
+ .attr("d", function (d) {
74
+ const pos = context.geohash.bounds(d[0]);
75
+ const route = {
76
+ type: "LineString",
77
+ coordinates: [
78
+ [pos.sw.lon, pos.ne.lat],
79
+ [pos.ne.lon, pos.ne.lat],
80
+ [pos.ne.lon, pos.sw.lat],
81
+ [pos.sw.lon, pos.sw.lat]
82
+ ]
83
+ };
84
+ return base._d3GeoPath(route);
85
+ })
86
+ .style("fill", function (d) {
87
+ const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
88
+ return retVal;
89
+ })
90
+ ;
91
+ this.geoHashPaths.exit().remove();
92
+ }
93
+
94
+ // Events ---
95
+ click(row, column, selected) {
96
+ }
97
+
98
+ dblclick(row, column, selected) {
99
+ }
100
+
101
+ paletteID: { (): string; (_: string): GeoHash };
102
+ paletteID_exists: () => boolean;
103
+ useClonedPalette: { (): boolean; (_: boolean): GeoHash };
104
+ useClonedPalette_exists: () => boolean;
105
+ opacity: { (): number; (_: number): GeoHash };
106
+ opacity_exists: () => boolean;
107
+ meshVisible: { (): boolean; (_: boolean): GeoHash };
108
+ meshVisible_exists: () => boolean;
109
+ meshColor: { (): string; (_: string): GeoHash };
110
+ meshColor_exists: () => boolean;
111
+ meshStrokeWidth: { (): number; (_: number): GeoHash };
112
+ meshStrokeWidth_exists: () => boolean;
113
+ }
114
+ GeoHash.prototype._class += " map_GeoHash";
115
+
116
+ GeoHash.prototype._palette = Palette.rainbow("default");
117
+
118
+ GeoHash.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", GeoHash.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
119
+ GeoHash.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
120
+
121
+ GeoHash.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
122
+
123
+ GeoHash.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
124
+ GeoHash.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
125
+ 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;
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;
10
+ }
package/src/Graph.ts CHANGED
@@ -1,98 +1,98 @@
1
- import { Pins } from "./Pins";
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";
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;
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;
13
+ }