@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/Projection.ts CHANGED
@@ -1,42 +1,42 @@
1
- import * as d3Geo from "d3-geo";
2
- import { albersUsaPr } from "./Utility.ts";
3
-
4
- // const d3Geo = _d3Geo.geo || _d3Geo.default || _d3Geo;
5
-
6
- enum Type {
7
- AzimuthalEqualArea,
8
- AzimuthalEquidistant,
9
- Gnomonic,
10
- Orthographic,
11
- Stereographic,
12
- AlbersUsa,
13
- AlbersUsaPr,
14
- Albers,
15
- ConicConformal,
16
- ConicEqualArea,
17
- ConicEquidistant,
18
- Equirectangular,
19
- Mercator,
20
- TransverseMercator
21
- }
22
- export const types: string[] = [];
23
- export const projections: { [key: string]: any } = {};
24
- for (const key in Type) {
25
- if (typeof key === "string") {
26
- types.push(key);
27
- if (key === "AlbersUsaPr") {
28
- projections[key] = albersUsaPr;
29
- } else {
30
- projections[key] = d3Geo[`geo${key}`];
31
- }
32
- }
33
- }
34
-
35
- export function resolve(id: string): any {
36
- const retVal = projections[id];
37
- if (retVal) {
38
- return retVal();
39
- }
40
- console.warn("Unknown projection: " + id);
41
- return d3Geo.geoMercator();
42
- }
1
+ import * as d3Geo from "d3-geo";
2
+ import { albersUsaPr } from "./Utility.ts";
3
+
4
+ // const d3Geo = _d3Geo.geo || _d3Geo.default || _d3Geo;
5
+
6
+ enum Type {
7
+ AzimuthalEqualArea,
8
+ AzimuthalEquidistant,
9
+ Gnomonic,
10
+ Orthographic,
11
+ Stereographic,
12
+ AlbersUsa,
13
+ AlbersUsaPr,
14
+ Albers,
15
+ ConicConformal,
16
+ ConicEqualArea,
17
+ ConicEquidistant,
18
+ Equirectangular,
19
+ Mercator,
20
+ TransverseMercator
21
+ }
22
+ export const types: string[] = [];
23
+ export const projections: { [key: string]: any } = {};
24
+ for (const key in Type) {
25
+ if (typeof key === "string") {
26
+ types.push(key);
27
+ if (key === "AlbersUsaPr") {
28
+ projections[key] = albersUsaPr;
29
+ } else {
30
+ projections[key] = d3Geo[`geo${key}`];
31
+ }
32
+ }
33
+ }
34
+
35
+ export function resolve(id: string): any {
36
+ const retVal = projections[id];
37
+ if (retVal) {
38
+ return retVal();
39
+ }
40
+ console.warn("Unknown projection: " + id);
41
+ return d3Geo.geoMercator();
42
+ }
@@ -1,8 +1,8 @@
1
- import { Layered } from "./Layered.ts";
2
-
3
- export class TestHeatMap extends Layered {
4
- constructor() {
5
- super();
6
- }
7
- }
8
- TestHeatMap.prototype._class += " map_TestHeatMap";
1
+ import { Layered } from "./Layered.ts";
2
+
3
+ export class TestHeatMap extends Layered {
4
+ constructor() {
5
+ super();
6
+ }
7
+ }
8
+ TestHeatMap.prototype._class += " map_TestHeatMap";
@@ -1,125 +1,125 @@
1
- import { json as d3Json } from "d3-request";
2
- import { select as d3Select } from "d3-selection";
3
- import * as topojson from "topojson-client";
4
- import { Choropleth, topoJsonFolder } from "./Choropleth.ts";
5
-
6
- export class TopoJSONChoropleth extends Choropleth {
7
- protected _prevRegion: string;
8
- protected choroPaths: any;
9
- protected _choroTopologyIndex: any;
10
- protected _choroTopologyFeatures: any;
11
-
12
- constructor() {
13
- super();
14
-
15
- this.projection("Mercator");
16
- }
17
-
18
- layerEnter(base, svgElement, domElement) {
19
- Choropleth.prototype.layerEnter.apply(this, arguments);
20
-
21
- this._selection.widgetElement(this._choroplethData);
22
- this.choroPaths = d3Select(null);
23
-
24
- const context = this;
25
- this
26
- .tooltipHTML(function (d) {
27
- const columns = context.columns();
28
- const series = columns && columns.length ? columns[0] : "Location";
29
- const origData = d && d.length ? d[d.length - 1] : [""];
30
- return context.tooltipFormat({ label: origData[0], series, value: d[1] });
31
- })
32
- ;
33
- }
34
-
35
- layerUpdate(base) {
36
- Choropleth.prototype.layerUpdate.apply(this, arguments);
37
- const data = [];
38
- const context = this;
39
- this.data().forEach(function (row) {
40
- if (isNaN(row[0])) {
41
- for (const key in context._choroTopologyIndex) {
42
- for (const key2 in context._choroTopologyIndex[key]) {
43
- if (key2 === row[0]) {
44
- context._choroTopologyIndex[key][key2].forEach(function (idx) {
45
- data.push([idx].concat(row.filter(function (d, i) { return i > 0; })).concat([row]));
46
- });
47
- }
48
- }
49
- }
50
- } else {
51
- data.push(row.concat([row]));
52
- }
53
- });
54
- this.choroPaths = this._choroplethData.selectAll(".data").data(this.visible() ? data : [], function (d) { return d[0]; });
55
- this.choroPaths.enter().append("path")
56
- .attr("class", "data")
57
- .call(this._selection.enter.bind(this._selection))
58
- .on("click", function (d) {
59
- if (context._dataMap[d[0]]) {
60
- context.click(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
61
- }
62
- })
63
- .on("dblclick", function (d) {
64
- if (context._dataMap[d[0]]) {
65
- context.dblclick(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
66
- }
67
- })
68
- .on("mouseout.tooltip", this.tooltip.hide)
69
- .on("mousemove.tooltip", this.tooltip.show)
70
- ;
71
- this.choroPaths
72
- .attr("d", function (d) {
73
- const retVal = base._d3GeoPath(context._choroTopologyFeatures[d[0]]);
74
- if (!retVal) {
75
- console.warn("Unknown Country: " + d);
76
- }
77
- return retVal;
78
- })
79
- .style("fill", function (d) {
80
- const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
81
- return retVal;
82
- })
83
- ;
84
- this.choroPaths.exit().remove();
85
- }
86
-
87
- layerPreRender() {
88
- if (this._prevRegion !== this.region()) {
89
- this._prevRegion = this.region();
90
- delete this._topoJsonPromise;
91
- }
92
-
93
- if (!this._topoJsonPromise) {
94
- const context = this;
95
- this._topoJsonPromise = new Promise<void>(function (resolve, reject) {
96
- d3Json(`${topoJsonFolder()}/${context.region()}.json`, function (region) {
97
- context._choroTopology = region;
98
- context._choroTopologyObjects = region.objects.PolbndA;
99
- context._choroTopologyFeatures = topojson.feature(context._choroTopology, context._choroTopologyObjects).features;
100
-
101
- d3Json(`${topoJsonFolder()}/${context.region()}_idx.json`, indexLoad)
102
- .on("error", function (err) {
103
- indexLoad({});
104
- })
105
- ;
106
-
107
- function indexLoad(index) {
108
- context._choroTopologyIndex = index;
109
- resolve();
110
- }
111
- });
112
- });
113
- }
114
- return this._topoJsonPromise;
115
- }
116
- }
117
- TopoJSONChoropleth.prototype._class += " map_TopoJSONChoropleth";
118
-
119
- export interface TopoJSONChoropleth {
120
- region(): string;
121
- region(_: string): this;
122
- region_exists(): boolean;
123
- }
124
-
125
- TopoJSONChoropleth.prototype.publish("region", "GB", "set", "Region Data", ["AT", "BE", "BG", "BR", "CHLI", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GE", "GR", "HR", "HU", "IE", "IS", "IT", "KS", "LT", "LU", "LV", "MD", "MK", "MT", "ND", "NL", "NO", "PL", "PT", "RO", "RS", "SE", "SI", "SK", "UA"]);
1
+ import { json as d3Json } from "d3-request";
2
+ import { select as d3Select } from "d3-selection";
3
+ import * as topojson from "topojson-client";
4
+ import { Choropleth, topoJsonFolder } from "./Choropleth.ts";
5
+
6
+ export class TopoJSONChoropleth extends Choropleth {
7
+ protected _prevRegion: string;
8
+ protected choroPaths: any;
9
+ protected _choroTopologyIndex: any;
10
+ protected _choroTopologyFeatures: any;
11
+
12
+ constructor() {
13
+ super();
14
+
15
+ this.projection("Mercator");
16
+ }
17
+
18
+ layerEnter(base, svgElement, domElement) {
19
+ Choropleth.prototype.layerEnter.apply(this, arguments);
20
+
21
+ this._selection.widgetElement(this._choroplethData);
22
+ this.choroPaths = d3Select(null);
23
+
24
+ const context = this;
25
+ this
26
+ .tooltipHTML(function (d) {
27
+ const columns = context.columns();
28
+ const series = columns && columns.length ? columns[0] : "Location";
29
+ const origData = d && d.length ? d[d.length - 1] : [""];
30
+ return context.tooltipFormat({ label: origData[0], series, value: d[1] });
31
+ })
32
+ ;
33
+ }
34
+
35
+ layerUpdate(base) {
36
+ Choropleth.prototype.layerUpdate.apply(this, arguments);
37
+ const data = [];
38
+ const context = this;
39
+ this.data().forEach(function (row) {
40
+ if (isNaN(row[0])) {
41
+ for (const key in context._choroTopologyIndex) {
42
+ for (const key2 in context._choroTopologyIndex[key]) {
43
+ if (key2 === row[0]) {
44
+ context._choroTopologyIndex[key][key2].forEach(function (idx) {
45
+ data.push([idx].concat(row.filter(function (d, i) { return i > 0; })).concat([row]));
46
+ });
47
+ }
48
+ }
49
+ }
50
+ } else {
51
+ data.push(row.concat([row]));
52
+ }
53
+ });
54
+ this.choroPaths = this._choroplethData.selectAll(".data").data(this.visible() ? data : [], function (d) { return d[0]; });
55
+ this.choroPaths.enter().append("path")
56
+ .attr("class", "data")
57
+ .call(this._selection.enter.bind(this._selection))
58
+ .on("click", function (d) {
59
+ if (context._dataMap[d[0]]) {
60
+ context.click(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
61
+ }
62
+ })
63
+ .on("dblclick", function (d) {
64
+ if (context._dataMap[d[0]]) {
65
+ context.dblclick(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
66
+ }
67
+ })
68
+ .on("mouseout.tooltip", this.tooltip.hide)
69
+ .on("mousemove.tooltip", this.tooltip.show)
70
+ ;
71
+ this.choroPaths
72
+ .attr("d", function (d) {
73
+ const retVal = base._d3GeoPath(context._choroTopologyFeatures[d[0]]);
74
+ if (!retVal) {
75
+ console.warn("Unknown Country: " + d);
76
+ }
77
+ return retVal;
78
+ })
79
+ .style("fill", function (d) {
80
+ const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
81
+ return retVal;
82
+ })
83
+ ;
84
+ this.choroPaths.exit().remove();
85
+ }
86
+
87
+ layerPreRender() {
88
+ if (this._prevRegion !== this.region()) {
89
+ this._prevRegion = this.region();
90
+ delete this._topoJsonPromise;
91
+ }
92
+
93
+ if (!this._topoJsonPromise) {
94
+ const context = this;
95
+ this._topoJsonPromise = new Promise<void>(function (resolve, reject) {
96
+ d3Json(`${topoJsonFolder()}/${context.region()}.json`, function (region) {
97
+ context._choroTopology = region;
98
+ context._choroTopologyObjects = region.objects.PolbndA;
99
+ context._choroTopologyFeatures = topojson.feature(context._choroTopology, context._choroTopologyObjects).features;
100
+
101
+ d3Json(`${topoJsonFolder()}/${context.region()}_idx.json`, indexLoad)
102
+ .on("error", function (err) {
103
+ indexLoad({});
104
+ })
105
+ ;
106
+
107
+ function indexLoad(index) {
108
+ context._choroTopologyIndex = index;
109
+ resolve();
110
+ }
111
+ });
112
+ });
113
+ }
114
+ return this._topoJsonPromise;
115
+ }
116
+ }
117
+ TopoJSONChoropleth.prototype._class += " map_TopoJSONChoropleth";
118
+
119
+ export interface TopoJSONChoropleth {
120
+ region(): string;
121
+ region(_: string): this;
122
+ region_exists(): boolean;
123
+ }
124
+
125
+ TopoJSONChoropleth.prototype.publish("region", "GB", "set", "Region Data", ["AT", "BE", "BG", "BR", "CHLI", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GE", "GR", "HR", "HU", "IE", "IS", "IT", "KS", "LT", "LU", "LV", "MD", "MK", "MT", "ND", "NL", "NO", "PL", "PT", "RO", "RS", "SE", "SI", "SK", "UA"]);