Public
Edited
Apr 2, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maplibregl = require("maplibre-gl@2.1.9")
Insert cell
Insert cell
lightpoles_ss_nyc1 = FileAttachment("lightpoles_ss_nyc (1).json").json()
Insert cell
shotspot_nyc1 = FileAttachment("shotspot_nyc-1.geojson").json()
Insert cell
shotspotter_pluto = FileAttachment("shotspotter_pluto.json").json()
Insert cell
viewof table = Inputs.table(shotspotter_pluto.features.map((s) => s.properties))
Insert cell
ssp = shotspotter_pluto.features
Insert cell
ownertypes = Object.entries(
Object.groupBy(ssp, ({ properties }) => properties.OwnerType)
)
.map((m) => {
return { OwnerType: m[0], Total: m[1].length };
})
.map((m) => {
if (m.OwnerType == "") {
m.OwnerType = "Blank";
return m;
} else {
return m;
}
})
.map((m, i) => {
m.OwnerType = labels[i];
return m;
})
Insert cell
labels = [
"Other",
"Blank",
"Tax-Exempt (City, State, or Other)",
"Private",
"City",
"Mixed Public/Private"
]
Insert cell
ownertypesPlot = Plot.plot({
y: {
grid: true
},
marks: [
Plot.ruleY([0]),
Plot.barY(ownertypes, {
fill: "teal",
x: "OwnerType",
y: "Total"
})
]
})
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