Published
Edited
May 5, 2021
1 fork
Insert cell
Insert cell
md` ## The Plan
* Focus on the State of Georgia for now
* All power producers in the state
* Use a drop down menu to select by type
* NAICS_DESC
* Only allow one type to be chosen at a time
* Different colored markers for each type
* Distance radius around each producer
* This radius can be used to summarize demographic data
* Also use polygons with demographic data
* Get from the Census using their API
* By county
* Use dropdown to select demographic data of interest
* This is for the choropleth map
* Show summary statistics for the state
* Think about locations of power producers in relation to demographic data
* To do
* Clean up attribution of data sources
* Especially the power plant data
* Think about charts
* Do this after the demographic data is sorted out
* What I want to do
* Get summary statistics of demographics based on centroids of county polygons within an adjustable distance of a power provider
* Minimum 2 miles, max 25 miles
* Create a state level summary of demograhics for counties within a certain distance from power producers
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
p_type
Insert cell
stateSelector = "13"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dataLayer2 ={
const datalayer2 = L.geoJSON(countiesFiltered).addTo(map);
invalidation.then(() => map.removeLayer(datalayer2));
return datalayer2;
}
Insert cell
polygon = turf.polygon(countiesFiltered[107].geometry)
Insert cell
polygon.geometry.coordinates
Insert cell
centroid = turf.centroid(polygon.geometry.coordinates)
Insert cell
countiesFiltered[42]
Insert cell
from = turf.point(powerFiltered[1].geometry.coordinates)
Insert cell
to = turf.point(centroid.geometry.coordinates)
Insert cell
options = {units: 'miles'};
Insert cell
distance = turf.distance(from, to, options);
Insert cell
Insert cell
Insert cell
[...new Set(rows.map(d => d.properties.NAICS_DESC))]
Insert cell
powerPlants.features[0].properties
Insert cell
Insert cell
usData = await d3.json('https://d3js.org/us-10m.v2.json')
Insert cell
Insert cell
stateData = topojson.feature(usData, usData.objects.states).features.filter((d) => d.id === '13');
Insert cell
counties = d3.json("https://opendata.arcgis.com/datasets/dc20713282734a73abe990995de40497_68.geojson")
Insert cell
counties2.features[0].properties.STATE_FIPS
Insert cell
counties2 = d3.json("https://opendata.arcgis.com/datasets/48f9af87daa241c4b267c5931ad3b226_0.geojson")
Insert cell
countiesFiltered[107]
Insert cell
countiesFiltered = counties2.features.filter(obj => obj.properties.STATE_FIPS === stateSelector)
Insert cell
powerFiltered = powerPlants.features.filter(obj => obj.properties.NAICS_DESC === p_type)
Insert cell
schoolData = d3.json("https://opendata.arcgis.com/datasets/fbc9d115d77d4badbaf8410ff8b2bd2a_0.geojson?where=%20(FCode%20%3D%20'School%3A%20Middle%20School'%20OR%20FCode%20%3D%20'School%3A%20High%20School')%20")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
topojson = require("topojson-client@3")
Insert cell
Insert cell
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