@hpcc-js/map 2.79.1 → 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 (89) 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 +19949 -19949
  11. package/dist/index.es6.js.map +1 -1
  12. package/dist/index.js +19947 -19947
  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
  88. package/types/__package__.d.ts +2 -2
  89. package/types-3.4/__package__.d.ts +2 -2
package/src/Projection.ts CHANGED
@@ -1,42 +1,42 @@
1
- import * as d3Geo from "d3-geo";
2
- import { albersUsaPr } from "./Utility";
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";
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";
2
-
3
- export class TestHeatMap extends Layered {
4
- constructor() {
5
- super();
6
- }
7
- }
8
- TestHeatMap.prototype._class += " map_TestHeatMap";
1
+ import { Layered } from "./Layered";
2
+
3
+ export class TestHeatMap extends Layered {
4
+ constructor() {
5
+ super();
6
+ }
7
+ }
8
+ TestHeatMap.prototype._class += " map_TestHeatMap";
@@ -1,114 +1,114 @@
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";
5
-
6
- export function TopoJSONChoropleth() {
7
- Choropleth.call(this);
8
-
9
- this.projection("Mercator");
10
- }
11
- TopoJSONChoropleth.prototype = Object.create(Choropleth.prototype);
12
- TopoJSONChoropleth.prototype.constructor = TopoJSONChoropleth;
13
- TopoJSONChoropleth.prototype._class += " map_TopoJSONChoropleth";
14
-
15
- 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"]);
16
-
17
- TopoJSONChoropleth.prototype.layerEnter = function (base, svgElement, domElement) {
18
- Choropleth.prototype.layerEnter.apply(this, arguments);
19
-
20
- this._selection.widgetElement(this._choroplethData);
21
- this.choroPaths = d3Select(null);
22
-
23
- const context = this;
24
- this
25
- .tooltipHTML(function (d) {
26
- const columns = context.columns();
27
- const series = columns && columns.length ? columns[0] : "Location";
28
- const origData = d && d.length ? d[d.length - 1] : [""];
29
- return context.tooltipFormat({ label: origData[0], series, value: d[1] });
30
- })
31
- ;
32
- };
33
-
34
- TopoJSONChoropleth.prototype.layerUpdate = function (base) {
35
- Choropleth.prototype.layerUpdate.apply(this, arguments);
36
- const data = [];
37
- const context = this;
38
- this.data().forEach(function (row) {
39
- if (isNaN(row[0])) {
40
- for (const key in context._choroTopologyIndex) {
41
- for (const key2 in context._choroTopologyIndex[key]) {
42
- if (key2 === row[0]) {
43
- context._choroTopologyIndex[key][key2].forEach(function (idx) {
44
- data.push([idx].concat(row.filter(function (d, i) { return i > 0; })).concat([row]));
45
- });
46
- }
47
- }
48
- }
49
- } else {
50
- data.push(row.concat([row]));
51
- }
52
- });
53
- this.choroPaths = this._choroplethData.selectAll(".data").data(this.visible() ? data : [], function (d) { return d[0]; });
54
- this.choroPaths.enter().append("path")
55
- .attr("class", "data")
56
- .call(this._selection.enter.bind(this._selection))
57
- .on("click", function (d) {
58
- if (context._dataMap[d[0]]) {
59
- context.click(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
60
- }
61
- })
62
- .on("dblclick", function (d) {
63
- if (context._dataMap[d[0]]) {
64
- context.dblclick(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
65
- }
66
- })
67
- .on("mouseout.tooltip", this.tooltip.hide)
68
- .on("mousemove.tooltip", this.tooltip.show)
69
- ;
70
- this.choroPaths
71
- .attr("d", function (d) {
72
- const retVal = base._d3GeoPath(context._choroTopologyFeatures[d[0]]);
73
- if (!retVal) {
74
- console.warn("Unknown Country: " + d);
75
- }
76
- return retVal;
77
- })
78
- .style("fill", function (d) {
79
- const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
80
- return retVal;
81
- })
82
- ;
83
- this.choroPaths.exit().remove();
84
- };
85
-
86
- TopoJSONChoropleth.prototype.layerPreRender = function () {
87
- if (this._prevRegion !== this.region()) {
88
- this._prevRegion = this.region();
89
- delete this._topoJsonPromise;
90
- }
91
-
92
- if (!this._topoJsonPromise) {
93
- const context = this;
94
- this._topoJsonPromise = new Promise<void>(function (resolve, reject) {
95
- d3Json(`${topoJsonFolder()}/${context.region()}.json`, function (region) {
96
- context._choroTopology = region;
97
- context._choroTopologyObjects = region.objects.PolbndA;
98
- context._choroTopologyFeatures = topojson.feature(context._choroTopology, context._choroTopologyObjects).features;
99
-
100
- d3Json(`${topoJsonFolder()}/${context.region()}_idx.json`, indexLoad)
101
- .on("error", function (err) {
102
- indexLoad({});
103
- })
104
- ;
105
-
106
- function indexLoad(index) {
107
- context._choroTopologyIndex = index;
108
- resolve();
109
- }
110
- });
111
- });
112
- }
113
- return this._topoJsonPromise;
114
- };
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";
5
+
6
+ export function TopoJSONChoropleth() {
7
+ Choropleth.call(this);
8
+
9
+ this.projection("Mercator");
10
+ }
11
+ TopoJSONChoropleth.prototype = Object.create(Choropleth.prototype);
12
+ TopoJSONChoropleth.prototype.constructor = TopoJSONChoropleth;
13
+ TopoJSONChoropleth.prototype._class += " map_TopoJSONChoropleth";
14
+
15
+ 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"]);
16
+
17
+ TopoJSONChoropleth.prototype.layerEnter = function (base, svgElement, domElement) {
18
+ Choropleth.prototype.layerEnter.apply(this, arguments);
19
+
20
+ this._selection.widgetElement(this._choroplethData);
21
+ this.choroPaths = d3Select(null);
22
+
23
+ const context = this;
24
+ this
25
+ .tooltipHTML(function (d) {
26
+ const columns = context.columns();
27
+ const series = columns && columns.length ? columns[0] : "Location";
28
+ const origData = d && d.length ? d[d.length - 1] : [""];
29
+ return context.tooltipFormat({ label: origData[0], series, value: d[1] });
30
+ })
31
+ ;
32
+ };
33
+
34
+ TopoJSONChoropleth.prototype.layerUpdate = function (base) {
35
+ Choropleth.prototype.layerUpdate.apply(this, arguments);
36
+ const data = [];
37
+ const context = this;
38
+ this.data().forEach(function (row) {
39
+ if (isNaN(row[0])) {
40
+ for (const key in context._choroTopologyIndex) {
41
+ for (const key2 in context._choroTopologyIndex[key]) {
42
+ if (key2 === row[0]) {
43
+ context._choroTopologyIndex[key][key2].forEach(function (idx) {
44
+ data.push([idx].concat(row.filter(function (d, i) { return i > 0; })).concat([row]));
45
+ });
46
+ }
47
+ }
48
+ }
49
+ } else {
50
+ data.push(row.concat([row]));
51
+ }
52
+ });
53
+ this.choroPaths = this._choroplethData.selectAll(".data").data(this.visible() ? data : [], function (d) { return d[0]; });
54
+ this.choroPaths.enter().append("path")
55
+ .attr("class", "data")
56
+ .call(this._selection.enter.bind(this._selection))
57
+ .on("click", function (d) {
58
+ if (context._dataMap[d[0]]) {
59
+ context.click(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
60
+ }
61
+ })
62
+ .on("dblclick", function (d) {
63
+ if (context._dataMap[d[0]]) {
64
+ context.dblclick(context.rowToObj(context._dataMap[d[0]]), "weight", context._selection.selected(context));
65
+ }
66
+ })
67
+ .on("mouseout.tooltip", this.tooltip.hide)
68
+ .on("mousemove.tooltip", this.tooltip.show)
69
+ ;
70
+ this.choroPaths
71
+ .attr("d", function (d) {
72
+ const retVal = base._d3GeoPath(context._choroTopologyFeatures[d[0]]);
73
+ if (!retVal) {
74
+ console.warn("Unknown Country: " + d);
75
+ }
76
+ return retVal;
77
+ })
78
+ .style("fill", function (d) {
79
+ const retVal = context._palette(d[1], context._dataMinWeight, context._dataMaxWeight);
80
+ return retVal;
81
+ })
82
+ ;
83
+ this.choroPaths.exit().remove();
84
+ };
85
+
86
+ TopoJSONChoropleth.prototype.layerPreRender = function () {
87
+ if (this._prevRegion !== this.region()) {
88
+ this._prevRegion = this.region();
89
+ delete this._topoJsonPromise;
90
+ }
91
+
92
+ if (!this._topoJsonPromise) {
93
+ const context = this;
94
+ this._topoJsonPromise = new Promise<void>(function (resolve, reject) {
95
+ d3Json(`${topoJsonFolder()}/${context.region()}.json`, function (region) {
96
+ context._choroTopology = region;
97
+ context._choroTopologyObjects = region.objects.PolbndA;
98
+ context._choroTopologyFeatures = topojson.feature(context._choroTopology, context._choroTopologyObjects).features;
99
+
100
+ d3Json(`${topoJsonFolder()}/${context.region()}_idx.json`, indexLoad)
101
+ .on("error", function (err) {
102
+ indexLoad({});
103
+ })
104
+ ;
105
+
106
+ function indexLoad(index) {
107
+ context._choroTopologyIndex = index;
108
+ resolve();
109
+ }
110
+ });
111
+ });
112
+ }
113
+ return this._topoJsonPromise;
114
+ };