Public
Edited
Dec 20, 2023
2 forks
Insert cell
Insert cell
viewof zoom = Inputs.range([0, 1], {label: "longitude", step: .001, value: .23})
Insert cell
viewof Floor_water = Inputs.toggle({label: "Floor water in 50 years"})
Insert cell
Floor_water
Insert cell
Select_asset = dgi.filter: (dgi, (d) => d3.asset_type("asset_type"))
Insert cell
Plot.plot({width: 3000,height:3000,
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(datasetwithdataproperty to create cloropleth, {fill: d => color(d.properties.POPULATION), fillOpacity: 0.2, type:"md"}),
// Plot.geo(_census_tracts__tabular_20231105, {fill: d => color(d.properties.POPULATION), fillOpacity: 0.2, type:"md"}),
Plot.geo(combinedHeatIndex,{fill: d => color2(d.properties.HVImedquin), fillOpacity:1,
//channels: {HVImedquin: (d) => d.properties.HVImedquin}, // Display asset_type in the tooltip
//title:(d) =>
//{d.HVImedquin}
}),
Plot.geo(combined, {fill: d => color(d.properties.Income), fillOpacity:0.5,
//channels: { Income: (d) => d.properties.Income }, // Display asset_type in the tooltip
// tip:true},
}),
Plot.geo(archivedParksProperties ,
{fill: "green",
stroke:"green",
fillOpacity: 1,
type:"md",
//channels: { typecatego: (d) => d.properties.typecatego}, // Display asset_type in the tooltip
//tip:true
}),
Plot.dot(dgi.features, {x: (d) => d.geometry.coordinates[0], y: (d) => d.geometry.coordinates[1],
r: 0.6,
stroke: "cyan",
fill: "none",
fillOpacity: 0.25,
// channels: { asset_type: (d) => d.properties.asset_type }, // Display asset_type in the tooltip
//tip: true
}),
Plot.geo(Flood, {
fill: "blue",
//stroke:"blue","strokeWidth":3,
fillOpacity: 0.6,
type: "md" }),
Plot.geo(censusTractsTabular_20231107 ,
{fill: "none",
stroke:"black","strokeWidth":0.25,
fillOpacity: 0.55,
type:"md"}),
]
//Floor_water.addEventListener("change", () => {
//FloodLayer.style("display", Floor_water.value ? "block" : "none");});
})
Insert cell
shoreline = FileAttachment("Shoreline.geojson")
Insert cell
archivedParksProperties = FileAttachment("ARCHIVED - Parks Properties.geojson").json()
Insert cell
censusTractsTabular_20231107 = FileAttachment("2020 Census Tracts - Tabular_20231107.geojson").json()
Insert cell
nyc_census_tracts@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
combined = {

var geo = censusTractsTabular_20231107.features
var data = nyc_census_tracts1

var combinedData = []
for (let i = 0; i < geo.length; i++) {
var lineName = Number(geo[i].properties.geoid)//dataset w/ lines, specify properties that has match key
for (let k = 0; k < data.length; k++) {
var dataName = data[k].CensusTract//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
Flood = FileAttachment("Sea Level Rise Maps (2050s 500-year Floodplain).geojson").json()
Insert cell
color = d3.scaleQuantize().domain([5000, 120000]).range(d3.schemePuBu[9]);
Insert cell
color2 = d3.scaleQuantize().domain([1,5]).range(d3.schemeYlOrRd[9]);
Insert cell
boroughs = FileAttachment("boroughs.geojson")
Insert cell
circle = d3.geoCircle().center([-73.9, 40.68]).radius(zoom)()
Insert cell
dgi = FileAttachment("DEP Green Infrastructure.geojson").json()
Insert cell
data-P5pGy.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
combinedHeatIndex = {

var geo = censusTractsTabular_20231107.features
var data = dataP5pgy

var combinedData = []
for (let i = 0; i < geo.length; i++) {
var lineName = String(geo[i].properties.nta2020)//dataset w/ lines, specify properties that has match key
for (let k = 0; k < data.length; k++) {
var dataName = data[k].NTACode//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

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