Public
Edited
Oct 31, 2023
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}),
Plot.dot(food.features, {x: (d) => d.geometry.coordinates[0], y: (d) => d.geometry.coordinates[1], r: 1, stroke: "blue", fill: "blue", fillOpacity: 0})
]
})
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([-73.94, 40.81]).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
food = FileAttachment("Food Scrap Drop-Off Locations in NYC_20231031.geojson").json()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more