@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.
- 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.es6.js +19949 -19949
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +19947 -19947
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +9 -9
- package/src/CanvasPinLayer.ts +99 -99
- package/src/CanvasPins.ts +396 -396
- package/src/Choropleth.css +27 -27
- package/src/Choropleth.ts +195 -195
- package/src/ChoroplethContinents.ts +13 -13
- package/src/ChoroplethCounties.ts +109 -109
- package/src/ChoroplethCountries.ts +100 -100
- package/src/ChoroplethStates.ts +104 -104
- package/src/ChoroplethStatesHeat.ts +8 -8
- package/src/GMap.css +16 -16
- package/src/GMap.ts +879 -879
- 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 +125 -125
- package/src/GeoHash.css +15 -15
- package/src/GeoHash.ts +125 -125
- package/src/Graph.css +10 -10
- package/src/Graph.ts +98 -98
- package/src/Graticule.css +13 -13
- package/src/Graticule.ts +90 -90
- package/src/Heat.css +2 -2
- package/src/Heat.ts +82 -82
- package/src/IChoropleth.ts +8 -8
- package/src/Layer.ts +90 -90
- package/src/Layered.css +19 -19
- package/src/Layered.ts +206 -206
- package/src/Lines.css +9 -9
- package/src/Lines.ts +75 -75
- package/src/OpenStreet.css +15 -15
- package/src/OpenStreet.ts +123 -123
- package/src/Pins.css +18 -18
- package/src/Pins.ts +319 -319
- package/src/Projection.ts +42 -42
- package/src/TestHeatMap.ts +8 -8
- package/src/TopoJSONChoropleth.ts +114 -114
- package/src/Utility.ts +482 -482
- package/src/__package__.ts +3 -3
- package/src/index.ts +34 -34
- 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 +238 -238
- 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 +171 -171
- package/src/leaflet/index.ts +18 -18
- package/src/test.ts +114 -114
- package/types/__package__.d.ts +2 -2
- 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
|
+
}
|
package/src/TestHeatMap.ts
CHANGED
|
@@ -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
|
+
};
|