Public
Edited
Dec 11, 2023
1 fork
Insert cell
Insert cell
Insert cell
Plot.plot({width:1200,height:1200,
projection: {type: "orthographic",rotate: [80, -34], domain:circle},
r: {transform: (d) => Math.pow(10, d)}, // convert Richter to amplitude
style: "overflow: visible;", // allow dots to escape
marks: [
Plot.geo(zips_combined, {fill: d => color(d.properties.PERCENT_FEMALE), fillOpacity: 0.2}),
Plot.geo(subwayLines, {fill: 'none', stroke: 'black', type:"md"}),
Plot.geo(parkingLot, {fill: d => color2(d.properties.shape_area), stroke: 'none', type:"md"}),
//Plot.geo(zips_combined,{stroke:'black'}),
Plot.sphere(),
Plot.dot(dgi.features, {x: (d) => d.geometry.coordinates[0], y: (d) => d.geometry.coordinates[1], r: .3, stroke: "red", fill: "red", fillOpacity: 0.2})
]
})
Insert cell
parkingLot = FileAttachment("Parking Lot.geojson").json()
Insert cell
parks = FileAttachment("Parks Properties_20231031.geojson").json()
Insert cell
subwayLines = FileAttachment("Subway Lines.geojson").json()
Insert cell
color = d3.scaleQuantize([0, 1], d3.schemeReds[9])
Insert cell
color2 = d3.scaleQuantize([0, 1000000], d3.schemeGreys[9])
Insert cell
circle = d3.geoCircle().center([-74, 40.7]).radius(zoom)()
Insert cell
world = FileAttachment("countries-110m.json").json()
Insert cell
nyc_zips = FileAttachment("nyc_zips.geojson").json()
Insert cell
zipdems = FileAttachment("zipdems.csv").csv()
Insert cell
dgi = FileAttachment("DEP Green Infrastructure.geojson").json()
Insert cell
zips_combined = {

var geo = nyc_zips.features
var data = deminfo

var combinedData = []
for (let i = 0; i < geo.length; i++) {
var lineName = Number(geo[i].properties.ZIPCODE)//dataset w/ lines, specify properties that has match key
for (let k = 0; k < data.length; k++) {
var dataName = data[k].JURISDICTION_NAME//none spatial dataset, specify properties that have match
if(lineName == dataName){//console.log('match')

combinedData.push({type:'Feature',properties:data[k],geometry:geo[i].geometry})
}
}
}

return {type: 'FeatureCollection',features:combinedData}

}
Insert cell
deminfo = d3.csv(demlink,d3.autoType)
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more