Skip to content

Commit f2f2434

Browse files
committed
Converting color JPS scale to five-color version now used by JP.
Closes #1.
1 parent 47a79fb commit f2f2434

File tree

5 files changed

+147
-76
lines changed

5 files changed

+147
-76
lines changed

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,32 @@
22

33
Father's Marble is an attempt to show the status of the Good News throughout the earth.
44

5-
Here's a screenshot of the view from the North Pole, with the Americas toward the top of the picture:
5+
Here's a screenshot of the view looking down on the North Pole, with the Americas toward the top of the picture:
66

77
![View of Father's Marble from the North Pole. The Americas are toward the top of the image.](documentation/NorthPole.png)
88

9+
In this particular screenshot (and the default setting for the application), the colors correspond to the [Progress
10+
Levels defined by Joshua Project](https://joshuaproject.net/global/progress).
11+
912
## Data Sources
1013

11-
Data regarding people groups and their beliefs come from [Joshua Project's public datasets and APIs](http://joshuaproject.net/resources/datasets).
12-
The Joshua Project exists to "Bring Definition to the Unfinished Task."
14+
Data regarding people groups and their beliefs come from [Joshua Project's public datasets and
15+
APIs](http://joshuaproject.net/resources/datasets). The Joshua Project exists to "Bring Definition to the Unfinished
16+
Task." Joshua Project data is updated in this application roughly once every two weeks.
1317

1418
Data regarding general global population distributions comes from NASA's
1519
[Gridded Population of the World, Version 3](http://sedac.ciesin.columbia.edu/data/set/gpw-v3-population-density)
16-
provided through CIESIN and CIAT, and are scaled such that the total world population roughly matches Joshua Project data.
20+
provided through CIESIN and CIAT, and are scaled such that the total world population roughly matches Joshua Project
21+
data.
1722

1823
Over different versions of this project, the imagery used on the globe has come from a variety of different sources:
1924

20-
- NASA's Black Marble Imagery. Original data courtesy NASA Earth Observatory and in the public domain.
2125
- Bing Maps. Licensed from Microsoft.
2226
- Natural Earth II. Public Domain.
27+
- NASA's Black Marble Imagery. Original data courtesy NASA Earth Observatory and in the public domain; this iteration
28+
is graciously hosted by AGI.
29+
30+
The particular copyrights that apply to the imagery actively in-use are listed at the bottom left of the application.
2331

2432
The graphics tool used here is [Cesium](http://cesiumjs.org), which is a really awesome mapping tool.
2533

@@ -38,8 +46,9 @@ specifically refers to _a people group in a particular location_. For instance,
3846
"Villages". Villages can be of drastically different sizes, both in terms of population, and in terms of geographic
3947
area covered.
4048

41-
A __Pile__ is _a collection of peoples who are designated into one statistical point_. One Pile may contain several
42-
Villages, and many Villages are spread between several piles.
49+
A __Pile__ is _a collection of peoples who are designated into a geographical point_. One Pile may contain several
50+
Villages, and many Villages are spread between several piles. Generally, one pile corresponds to one vertical
51+
multi-colored stack. Hence, "pile".
4352

4453
## How It Works
4554

@@ -86,7 +95,8 @@ there will appear to be an unrealistically high number of Han Chinese listed in
8695
### Ambiguous Population Distribution Data
8796

8897
While we have distribution information for the human race as a whole, there is no readily available data that addresses
89-
the issue of which Piles should contain each Village, when the Village population is larger than that of the pile.
98+
the issue of which Piles should contain each Village, when the Village population is larger than that of the closest
99+
pile.
90100

91101
## Contributing, Building and Other Participation
92102

@@ -128,6 +138,8 @@ To __update__ the node dependencies, from the root directory of the repository,
128138

129139
npm update
130140

131-
There is no build procedure for the application, as it is (for now, anyway) completely static. Just put the files in a
132-
web server, and you'll have a working application.
141+
<strike>There is no build procedure for the application, as it is (for now, anyway) completely static. Just put the
142+
files in a web server, and you'll have a working application. </strike>
143+
To build this application, you need LESS, and probably should minify everything. Creating a simplified build procedure
144+
is [issue #2](https://github.com/jkrrv/FathersMarble/issues/2).
133145

app/main.js

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ requirejs(['Cesium'], function(Cesium) {
4242
Pile.prototype.calcHeights = function(format) {
4343
var out = {
4444
r: 0,
45+
o: 0,
4546
y: 0,
47+
s: 0,
4648
g: 0,
4749
sum: 0
4850
};
@@ -57,7 +59,11 @@ requirejs(['Cesium'], function(Cesium) {
5759
if (people.jps < 2) {
5860
out.r += people.pop;
5961
} else if (people.jps < 3) {
62+
out.o += people.pop;
63+
} else if (people.jps < 4) {
6064
out.y += people.pop;
65+
} else if (people.jps < 5) {
66+
out.s += people.pop;
6167
} else {
6268
out.g += people.pop;
6369
}
@@ -208,7 +214,7 @@ requirejs(['Cesium'], function(Cesium) {
208214
* Gets or sets the name of the series to display. WebGL JSON is designed
209215
* so that only one series is viewed at a time. Valid values are defined
210216
* in the seriesNames property.
211-
* @memberof WebGLGlobeDataSource.prototype
217+
* @memberOf WebGLGlobeDataSource.prototype
212218
* @type {String}
213219
*/
214220
seriesToDisplay : {
@@ -347,14 +353,16 @@ requirejs(['Cesium'], function(Cesium) {
347353
var peoples = new Pile(geo.peoples);
348354

349355
// TODO make calculation selection a dynamic feature
350-
// var heights = peoples.calcHeights(Peoples.heightFormat.JPS);
351-
var heights = peoples.calcHeights(Pile.heightFormat.PROFESS);
356+
var heights = peoples.calcHeights(Pile.heightFormat.JPS);
357+
// var heights = peoples.calcHeights(Pile.heightFormat.PROFESS);
352358

353359
// TODO break this into more functions so things are more readily callable when user options are made available.
354360

355361
// Calculate heights for each colored bar
356362
heights.g = heights.g >> heightScale;
363+
heights.s = heights.s >> heightScale;
357364
heights.y = heights.y >> heightScale;
365+
heights.o = heights.o >> heightScale;
358366
heights.r = heights.r >> heightScale;
359367

360368

@@ -366,9 +374,9 @@ requirejs(['Cesium'], function(Cesium) {
366374
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g/2),
367375
cylinder: {
368376
length: heights.g,
369-
topRadius: widthScale,
377+
topRadius: parseInt(widthScale),
370378
slices: slices,
371-
bottomRadius: widthScale,
379+
bottomRadius: parseInt(widthScale),
372380
material: Cesium.Color.GREEN.withAlpha(.4)
373381
},
374382
seriesName : "g"
@@ -377,17 +385,36 @@ requirejs(['Cesium'], function(Cesium) {
377385
h++;
378386
}
379387

388+
// Create "SpringGreeen" bar
389+
if (heights.s > 1) {
390+
entities.add(new Cesium.Entity({
391+
id : "s" + ' index ' + x.toString(),
392+
show : true,
393+
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + (heights.s/2)),
394+
cylinder: {
395+
length: heights.s,
396+
topRadius: parseInt(widthScale),
397+
slices: slices,
398+
bottomRadius: parseInt(widthScale),
399+
material: Cesium.Color.GREENYELLOW.withAlpha(.4)
400+
},
401+
seriesName : "s"
402+
}));
403+
404+
h++;
405+
}
406+
380407
// Create Yellow bar
381408
if (heights.y > 1) {
382409
entities.add(new Cesium.Entity({
383410
id : "y" + ' index ' + x.toString(),
384411
show : true,
385-
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + (heights.y/2)),
412+
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + heights.s + (heights.y/2)),
386413
cylinder: {
387414
length: heights.y,
388-
topRadius: widthScale,
415+
topRadius: parseInt(widthScale),
389416
slices: slices,
390-
bottomRadius: widthScale,
417+
bottomRadius: parseInt(widthScale),
391418
material: Cesium.Color.YELLOW.withAlpha(.4)
392419
},
393420
seriesName : "y"
@@ -396,17 +423,36 @@ requirejs(['Cesium'], function(Cesium) {
396423
h++;
397424
}
398425

426+
// Create Orange bar
427+
if (heights.o > 1) {
428+
entities.add(new Cesium.Entity({
429+
id : "o" + ' index ' + x.toString(),
430+
show : true,
431+
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + heights.s + heights.y + (heights.o/2)),
432+
cylinder: {
433+
length: heights.o,
434+
topRadius: parseInt(widthScale),
435+
slices: slices,
436+
bottomRadius: parseInt(widthScale),
437+
material: Cesium.Color.ORANGE.withAlpha(.4)
438+
},
439+
seriesName : "o"
440+
}));
441+
442+
h++;
443+
}
444+
399445
// Create Red bar
400446
if (heights.r > 1) {
401447
entities.add(new Cesium.Entity({
402448
id : "r" + ' index ' + x.toString(),
403449
show : true,
404-
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + heights.y + (heights.r/2)),
450+
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, heights.g + heights.s + heights.y + heights.o + (heights.r/2)),
405451
cylinder: {
406452
length: heights.r,
407-
topRadius: widthScale,
453+
topRadius: parseInt(widthScale),
408454
slices: slices,
409-
bottomRadius: widthScale,
455+
bottomRadius: parseInt(widthScale),
410456
material: Cesium.Color.RED.withAlpha(.4)
411457
},
412458
seriesName : "r"
@@ -437,12 +483,8 @@ requirejs(['Cesium'], function(Cesium) {
437483
var dataSource = new WebGLGlobeDataSource();
438484
dataSource.loadUrl('data/geo.json').then(function() {
439485

440-
//After the initial load, create buttons to let the user switch among series.
441-
function createSeriesSetter(seriesName) {
442-
return function() {
443-
dataSource.seriesToDisplay = seriesName;
444-
};
445-
}
486+
// TODO UI Option population
487+
446488
});
447489

448490
Cesium.BingMapsApi.defaultKey = 'AjUK0-UaaYujmmlMT2iXlFADNDnttZM4F5ADqiCfdP-y_JojoP8089gU-nzdGhNe';
@@ -493,7 +535,7 @@ requirejs(['Cesium'], function(Cesium) {
493535
// // layer.brightness = 0.8;
494536
// }
495537

496-
viewer.dataSources.add(dataSource);
538+
viewer.dataSources.add(dataSource).then(); // TODO use this to close the loading overlay
497539

498540
// Add credit footnote for Joshua Project
499541
var credit = new Cesium.Credit('Joshua Project', 'assets/jp_logo_color.png', 'http://joshuaproject.net');

0 commit comments

Comments
 (0)