-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathregulargrid.js
41 lines (35 loc) · 972 Bytes
/
regulargrid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { simple } from "./simple.js";
import { grid } from "../helpers/grid.js";
import { geoIdentity } from "d3-geo";
export function regulargrid(
selection,
projection,
options = {},
clipid,
width,
height
) {
options.geojson = grid({
geojson: options.geojson,
output: "square",
projection: projection,
width: width,
height: height,
step: options.step,
values: options.values,
blur: options.blur,
geoprocessing: options.geoprocessing,
operator: options.operator,
});
if (options.fill == undefined) {
options.fill = { nbreaks: 6, method: "quantile", colors: "Blues" };
}
if (typeof options.fill == "object" && options.fill.values == undefined) {
options.fill.values = "value";
}
if (typeof options.fill == "object" && options.fill.type == undefined) {
options.fill.type = "choro";
}
options._type = "regulargrid";
simple(selection, geoIdentity(), options, clipid, width, height);
}