Last active
August 29, 2015 14:21
-
-
Save jenningsanderson/77eed8d796fe129279b7 to your computer and use it in GitHub Desktop.
An osmdown file (project-epic.github.com/osmdown) for the Whitehouse Mapathon. Live at: http://ec2-54-242-150-21.compute-1.amazonaws.com/mapathon/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
###Project Information | |
title: 'Whitehouse Mapathon' | |
###Where the data live | |
baseurl: '../' | |
www: '/usr/share/nginx/html/mapathon' | |
--- | |
#May 21 Whitehouse Mapathon | |
``` | |
var dataURL = '/usr/share/nginx/html/mapathon/' | |
var total_mappers = _.values(osmdata(dataURL+'total_user_count.json'))[0] | |
var experienced_mappers = _.values(osmdata(dataURL + 'experienced_user_count.json'))[0] | |
var new_mappers = _.values(osmdata(dataURL + 'new_user_count.json'))[0] | |
var options = { | |
chartType: 'linegraph_simple', width:1200, id: 'PerHour' | |
} | |
var changesets = osmdata(dataURL+'changesets_x_hour.json') | |
var hourly_changesets = [] | |
var totalChangesets = 0 | |
var hourlyUsers = [] | |
var cumulativeUsers = [] | |
var cumulativeUserIds = [] | |
for (var i=0; i < changesets.length; i ++) { | |
if (new Date(changesets[i].start_date) > new Date('2015-05-19 14:00:00 +0000') && new Date(changesets[i].start_date) < new Date().getTime()) { | |
hourly_changesets[i] = {} | |
hourly_changesets[i].date = changesets[i].start_date | |
hourly_changesets[i].value = changesets[i].objects.length | |
totalChangesets += changesets[i].objects.length | |
uniqueUsers = _.uniq(_.collect(changesets[i].objects, 'uid')) | |
hourlyUsers[i] = {} | |
hourlyUsers[i].date = changesets[i].start_date | |
hourlyUsers[i].value = uniqueUsers.length | |
} | |
} | |
var toPlot = [ | |
{id: 'cSets', title: "Changesets", data: _.compact(hourly_changesets)}, | |
{id: 'actUsers', title: "Active Users", data: _.compact(hourlyUsers)} | |
] | |
``` | |
#Changesets | |
``` | |
//Another comment | |
``` | |
{{ osmviz.linechart(toPlot,options) }} | |
<p style="font-size:10px; margin:-10px 0px 0px 35px;">UTC/GMT Time</p> | |
``` | |
//Spacing Comment | |
//Checking for update | |
``` | |
#Individual User Contributions | |
<p style="font-size:22px; margin-top:20px;"><strong>{{ numeral(total_mappers).format('0,0') }}</strong> total mappers with <strong>{{ numeral(new_mappers).format('0,0') }}</strong> new mappers.</p> | |
``` | |
var userList = osmdata(dataURL+ 'user_list.json') | |
var userTable = [] | |
var ops = {headers:["User","Node Count", "Way Count", "Changeset Count"], row_function:'showUserEditsFromRows'} | |
userList.forEach(function(user){ | |
userTable.push([user.user, user.nodes, user.ways, user.changesets]) | |
}) | |
ops.title="userTable" | |
``` | |
<div style="width:45%; display:inline-block">{{ osmviz.table('full', userTable, ops) }}</div><div style="width:54%; display:inline-block; vertical-align:top;">{{osmviz.map('user_contributions', {name: "UserContributions", height: 550, width: 700, path: '/mapathon/'}) }}</div> | |
``` | |
// Highways | |
var highways_per_tag = osmdata(dataURL + 'number_of_highways_per_tag.json') | |
var totalHighways = 0 | |
var highwayTable = [] | |
var options = {headers:['Tag', 'Count']} | |
highways_per_tag.forEach(function(d){ | |
highwayTable.push([d.tag, d.count]) | |
totalHighways = totalHighways + d.count | |
}) | |
// Buildings | |
var buildings_per_tag = osmdata(dataURL + 'number_of_buildings_per_tag.json') | |
var buildingsTable = [] | |
var buildingCount = 0 | |
var options = {headers:['Tag', 'Count']} | |
buildings_per_tag.forEach(function(d){ | |
buildingsTable.push([d.tag, d.count]) | |
buildingCount = buildingCount + d.count | |
}) | |
// Changesets | |
var changesets_per_tag = osmdata(dataURL + 'number_of_changesets_per_tag.json') | |
var changesetTable = [] | |
var changesetCount = 0 | |
var options = {headers:['Tag', 'Count']} | |
changesets_per_tag.forEach(function(d){ | |
changesetTable.push([d.tag, d.count]) | |
changesetCount = changesetCount + d.count | |
}) | |
// Ways | |
var ways_per_tag = osmdata(dataURL + 'number_of_ways_per_tag.json') | |
var wayTable = [] | |
var wayCount = 0 | |
var options = {headers:['Tag', 'Count']} | |
ways_per_tag.forEach(function(d){ | |
wayTable.push([d.tag, d.count]) | |
wayCount = wayCount + d.count | |
}) | |
//Totals | |
var totalOptions = {headers: ['Roads', 'Buildings', 'Ways','Changesets']} | |
var totalValues = [[totalHighways, buildingCount, wayCount, changesetCount]] | |
``` | |
#Total Object Counts | |
``` | |
//where I had to add a comment | |
``` | |
{{ osmviz.table('simple', totalValues, totalOptions) }} | |
``` | |
options = {headers:['Tag', 'Count']} | |
``` | |
<div style="float:left; display:inline-block; margin:10px; width:21%; vertical-align:top;"><h2>Roads</h2> | |
{{osmviz.table('simple', highwayTable, options) }}<p style="text-align:right">Total: <strong>{{totalHighways}}</strong></p></div> | |
``` | |
options = {headers:['Tag', 'Count']} | |
``` | |
<div style="float:left; display:inline-block; margin:10px; width:21%; vertical-align:top;"><h2>Buildings</h2>{{osmviz.table('simple', buildingsTable, options) }}<p style="text-align:right">Total: <strong>{{buildingCount}}</strong></p></div> | |
``` | |
options = {headers:['Tag', 'Count']} | |
``` | |
<div style="float:left; display:inline-block; margin:10px; width:21%; vertical-align:top;"><h2>Ways</h2>{{osmviz.table('simple', wayTable, options) }}<p style="text-align:right">Total: <strong>{{wayCount}}</strong></p></div> | |
``` | |
options = {headers:['Tag', 'Count']} | |
``` | |
<div style="float:left; display:inline-block; margin:10px; width:21%; vertical-align:top;"><h2>Total Changesets</h2>{{osmviz.table('simple', changesetTable, options) }}<p style="text-align:right">Total: <strong>{{changesetCount}}</strong></p></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment