Published
Edited
Dec 14, 2019
Importers
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
md`### linestrings`
Insert cell
linestrings = ({type: "FeatureCollection", features: geojson.features.filter(keeper) })
Insert cell
renderTable(linestrings.features.map(d => d.properties))
Insert cell
keeper = d => (typeof d.properties.highway !== 'undefined') && d.geometry.type == "LineString"
Insert cell
Insert cell
interesting = geojson.features.filter(d =>
typeof d.properties.highway == 'undefined'
&& typeof d.properties.name !== 'undefined'
&& d.properties.name !== 'Lumber River'
&& !d.properties.name.includes('Branch')
&& d.properties.name.includes('School')
&& d.geometry.type == "Point"
)
Insert cell
d3.set(interesting.map(d => d.properties.name)).values()
Insert cell
renderTable(interesting.map(d => d.properties))
Insert cell
unique_interesting_features = d3.set(geojson.features.filter(d => typeof d.properties.highway == 'undefined' && typeof d.properties.name !== 'undefined').map(d => d.properties.name)).values()
Insert cell
Insert cell
{
const props = geojson.features.map(d => d.properties);
const all = Object.keys(geojson.features[0].properties);
const interesting = ["highway", "name", "place", "type"];
const uninteresting = all.filter(d => !interesting.includes(d))
// Remove "uninteresting" properties from an object
function removeProps(obj) {
uninteresting.forEach(d => delete obj[d])
}
props.forEach(removeProps)
return props[0]
}
Insert cell
renderTable(geojson.features.map(d => d.properties))
Insert cell
Insert cell
Insert cell
geojson = FileAttachment("file.geojson").json()
Insert cell
osm = FileAttachment("map@1.osm").text()
Insert cell
Insert cell
import { renderTable } from "@pbogden/fancy-tables-ii"
Insert cell
d3 = require('d3@5')
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