Skip to content

Commit bef7e75

Browse files
committed
closes #2085
1 parent 7c8a465 commit bef7e75

File tree

10 files changed

+1930
-2
lines changed

10 files changed

+1930
-2
lines changed

src/marks/geo.js

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export class Geo extends Mark {
2323
data,
2424
{
2525
geometry: {value: options.geometry, scale: "projection"},
26+
x: {value: options.x, scale: "x", optional: true},
27+
y: {value: options.y, scale: "y", optional: true},
2628
r: {value: vr, scale: "r", filter: positive, optional: true}
2729
},
2830
withDefaultSort(options),

src/transforms/centroid.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ export function centroid({geometry = identity, ...options} = {}) {
1616
facets,
1717
channels: {
1818
x: {value: X, scale: projection == null ? "x" : null, source: null},
19-
y: {value: Y, scale: projection == null ? "y" : null, source: null}
19+
y: {value: Y, scale: projection == null ? "y" : null, source: null},
20+
geometry: {value: G}
2021
}
2122
};
2223
});
2324
}
2425

25-
export function geoCentroid({geometry = identity, ...options} = {}) {
26+
export function geoCentroid(options = {}) {
2627
let C;
28+
const {geometry = identity} = options;
2729
return {
2830
...options,
2931
x: {transform: (data) => Float64Array.from((C = valueof(valueof(data, geometry), GeoCentroid)), ([x]) => x)},

test/data/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ CBO
115115
https://www.cbo.gov/topics/budget/accuracy-projections
116116
https://observablehq.com/@tophtucker/examples-of-bitemporal-charts
117117

118+
## london.json
119+
giCentre, City University of London
120+
https://github.com/gicentre/data
121+
122+
## london-car-access.csv
123+
Jo Wood, TK
124+
118125
## metros.csv
119126
The New York Times
120127
https://www.nytimes.com/2019/12/02/upshot/wealth-poverty-divide-american-cities.html

test/data/london-car-access.csv

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
borough,y2001,y2011,y2021
2+
City of London,0.380,0.306,0.228
3+
Barking and Dagenham,0.621,0.604,0.652
4+
Barnet,0.733,0.713,0.701
5+
Bexley,0.763,0.763,0.776
6+
Brent,0.627,0.570,0.559
7+
Bromley,0.770,0.765,0.771
8+
Camden,0.444,0.389,0.364
9+
Croydon,0.702,0.665,0.664
10+
Ealing,0.683,0.647,0.632
11+
Enfield,0.715,0.675,0.690
12+
Greenwich,0.592,0.580,0.569
13+
Hammersmith and Fulham,0.514,0.448,0.425
14+
Haringey,0.535,0.482,0.473
15+
Harrow,0.773,0.765,0.753
16+
Havering,0.767,0.770,0.785
17+
Hillingdon,0.783,0.773,0.777
18+
Hounslow,0.714,0.684,0.672
19+
Islington,0.424,0.353,0.331
20+
Kensington and Chelsea,0.496,0.440,0.417
21+
Kingston upon Thames,0.762,0.749,0.743
22+
Lambeth,0.491,0.422,0.420
23+
Lewisham,0.572,0.519,0.523
24+
Merton,0.699,0.674,0.670
25+
Newham,0.511,0.479,0.483
26+
Redbridge,0.738,0.721,0.725
27+
Richmond upon Thames,0.763,0.753,0.746
28+
Southwark,0.481,0.416,0.397
29+
Sutton,0.767,0.766,0.772
30+
Tower Hamlets,0.432,0.370,0.336
31+
Waltham Forest,0.610,0.581,0.579
32+
Wandsworth,0.593,0.547,0.521
33+
Westminster,0.436,0.371,0.338
34+
Hackney,0.440,0.354,0.351

0 commit comments

Comments
 (0)