Skip to content

Commit bf839d3

Browse files
committed
add albers projection
1 parent 2b74d71 commit bf839d3

10 files changed

+207
-3
lines changed

src/plots/geo/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports.projNames = {
2626
'sinusoidal': 'sinusoidal',
2727

2828
'airy': 'airy',
29-
// 'albers': 'albers',
29+
'albers': 'albers',
3030
// 'armadillo': 'armadillo',
3131
'august': 'august',
3232
'baker': 'baker',

src/plots/geo/layout_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
3535

3636
var isScoped = geoLayoutOut._isScoped = (scope !== 'world');
3737
var isSatellite = geoLayoutOut._isSatellite = projType === 'satellite';
38-
var isConic = geoLayoutOut._isConic = projType.indexOf('conic') !== -1;
38+
var isConic = geoLayoutOut._isConic = projType.indexOf('conic') !== -1 || projType === 'albers';
3939
var isClipped = geoLayoutOut._isClipped = !!constants.lonaxisSpan[projType];
4040

4141
if(geoLayoutIn.visible === false) {
15.9 KB
Loading
Loading
21.3 KB
Loading

test/image/mocks/canada_geo_projections.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,52 @@
9292
],
9393
"hoverinfo": "skip"
9494
},
95+
{
96+
"name": "albers",
97+
"geo": "geo3",
98+
"type": "choropleth",
99+
"locations": ["CAN"],
100+
"z": [1],
101+
"showscale": false,
102+
"hovertemplate": "albers"
103+
},
104+
{
105+
"geo": "geo3",
106+
"type": "scattergeo",
107+
"mode": "markers+text",
108+
"text": [
109+
"Vancouver",
110+
"Montreal"
111+
],
112+
"textfont": {
113+
"size": 6
114+
},
115+
"marker": {
116+
"color": [
117+
"lightgreen",
118+
"blue"
119+
],
120+
"size": 10
121+
},
122+
"lat": [49, 45.5],
123+
"lon": [-123, -73.5]
124+
},
125+
{
126+
"geo": "geo3",
127+
"type": "scattergeo",
128+
"mode": "text",
129+
"text": [
130+
"albers"
131+
],
132+
"textfont": {
133+
"color": "darkred",
134+
"family": "Gravitas One, cursive"
135+
},
136+
"locations": [
137+
"CAN"
138+
],
139+
"hoverinfo": "skip"
140+
},
95141
{
96142
"name": "albers usa",
97143
"geo": "geo83",
@@ -3850,6 +3896,29 @@
38503896
"showcoastlines": false,
38513897
"showocean": true
38523898
},
3899+
"geo3": {
3900+
"domain": {
3901+
"row": 2,
3902+
"column": 0
3903+
},
3904+
"fitbounds": "locations",
3905+
"projection": {
3906+
"rotation": {"lat": 45},
3907+
"type": "albers"
3908+
},
3909+
"lonaxis": {
3910+
"showgrid": true,
3911+
"gridwidth": 1,
3912+
"gridcolor": "lightgray"
3913+
},
3914+
"lataxis": {
3915+
"showgrid": true,
3916+
"gridwidth": 1,
3917+
"gridcolor": "lightgray"
3918+
},
3919+
"showcoastlines": false,
3920+
"showocean": true
3921+
},
38533922
"geo83": {
38543923
"domain": {
38553924
"row": 2,

test/image/mocks/geo_fitbounds-locations.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,29 @@
4646
],
4747
"hoverinfo": "skip"
4848
},
49+
{
50+
"name": "albers",
51+
"geo": "geo3",
52+
"type": "choropleth",
53+
"locations": [
54+
"AUS"
55+
],
56+
"z": [
57+
10
58+
],
59+
"showscale": false,
60+
"hovertemplate": "albers"
61+
},
62+
{
63+
"geo": "geo3",
64+
"type": "scattergeo",
65+
"mode": "text",
66+
"text": "albers",
67+
"locations": [
68+
"AUS"
69+
],
70+
"hoverinfo": "skip"
71+
},
4972
{
5073
"name": "albers usa",
5174
"geo": "geo83",
@@ -1962,6 +1985,28 @@
19621985
"showcoastlines": false,
19631986
"showocean": true
19641987
},
1988+
"geo3": {
1989+
"domain": {
1990+
"row": 2,
1991+
"column": 0
1992+
},
1993+
"projection": {
1994+
"type": "albers"
1995+
},
1996+
"fitbounds": "locations",
1997+
"lonaxis": {
1998+
"showgrid": true,
1999+
"gridwidth": 1,
2000+
"gridcolor": "lightgray"
2001+
},
2002+
"lataxis": {
2003+
"showgrid": true,
2004+
"gridwidth": 1,
2005+
"gridcolor": "lightgray"
2006+
},
2007+
"showcoastlines": false,
2008+
"showocean": true
2009+
},
19652010
"geo83": {
19662011
"domain": {
19672012
"row": 2,

test/image/mocks/various_geo_projections.json

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,74 @@
136136
],
137137
"hoverinfo": "skip"
138138
},
139+
{
140+
"name": "albers",
141+
"geo": "geo3",
142+
"type": "choropleth",
143+
"locations": [
144+
"GHA",
145+
"ARG",
146+
"AUS",
147+
"CAN"
148+
],
149+
"z": [
150+
1,
151+
2,
152+
3,
153+
4
154+
],
155+
"showscale": false,
156+
"hovertemplate": "albers"
157+
},
158+
{
159+
"geo": "geo3",
160+
"type": "scattergeo",
161+
"mode": "markers+text",
162+
"text": [
163+
"Cape Town",
164+
"Los Angeles"
165+
],
166+
"textfont": {
167+
"size": 6
168+
},
169+
"marker": {
170+
"color": [
171+
"lightgreen",
172+
"yellow"
173+
],
174+
"size": [
175+
20,
176+
10
177+
]
178+
},
179+
"lat": [
180+
-34,
181+
34
182+
],
183+
"lon": [
184+
18,
185+
-118
186+
]
187+
},
188+
{
189+
"geo": "geo3",
190+
"type": "scattergeo",
191+
"mode": "text",
192+
"text": [
193+
"albers"
194+
],
195+
"textfont": {
196+
"color": "darkblue",
197+
"family": "Gravitas One, cursive"
198+
},
199+
"locations": [
200+
"GHA",
201+
"ARG",
202+
"AUS",
203+
"CAN"
204+
],
205+
"hoverinfo": "skip"
206+
},
139207
{
140208
"name": "albers usa",
141209
"geo": "geo83",
@@ -5650,6 +5718,27 @@
56505718
"showcoastlines": false,
56515719
"showocean": true
56525720
},
5721+
"geo3": {
5722+
"domain": {
5723+
"row": 2,
5724+
"column": 0
5725+
},
5726+
"projection": {
5727+
"type": "albers"
5728+
},
5729+
"lonaxis": {
5730+
"showgrid": true,
5731+
"gridwidth": 1,
5732+
"gridcolor": "lightgray"
5733+
},
5734+
"lataxis": {
5735+
"showgrid": true,
5736+
"gridwidth": 1,
5737+
"gridcolor": "lightgray"
5738+
},
5739+
"showcoastlines": false,
5740+
"showocean": true
5741+
},
56535742
"geo83": {
56545743
"domain": {
56555744
"row": 2,

test/jasmine/tests/geo_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe('Test Geo layout defaults', function() {
177177

178178
projTypes.forEach(function(projType) {
179179
testOne(projType);
180-
if(projType.indexOf('conic') !== -1) {
180+
if(projType.indexOf('conic') !== -1 || projType === 'albers') {
181181
expect(layoutOut.geo.projection.parallels).toBeDefined();
182182
} else {
183183
expect(layoutOut.geo.projection.parallels).toBeUndefined();

test/plot-schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,6 +2089,7 @@
20892089
"aitoff",
20902090
"sinusoidal",
20912091
"airy",
2092+
"albers",
20922093
"august",
20932094
"baker",
20942095
"bertin1953",

0 commit comments

Comments
 (0)