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

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