Public
Edited
Apr 5, 2023
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// osmFeatures = [
// ...new Set(
// csv
// .filter((item) => item.OpenStreetMap)
// .map((item) => item.OpenStreetMap.split("\n"))
// .flat()
// )
// ]
Insert cell
// osmFeatureDetails = {
// const match = osmFeatures.map(
// (url) =>
// url.match(/https:\/\/www.openstreetmap.org\/(?<type>.*?)\/(?<id>\d*)/)
// .groups
// );
// return match;
// }
Insert cell
// overpassQuery = `[out:json][timeout:25];
// (
// ${osmFeatureDetails
// .map((feature) => feature.type + "(" + feature.id + ")" + ";")
// .join("\n")}
// );
// out body;
// >;
// out skel qt;`
Insert cell
// overpassQueryResult = {
// const overpass = "https://overpass-api.de/api/interpreter";
// const url = `${overpass}?data=${encodeURIComponent(overpassQuery)}`;
// const result = fetch(url).then((response) => {
// const contentType = response.headers.get("content-type");
// if (!contentType || !contentType.includes("application/json")) {
// throw new TypeError(
// "OpenStreetMap's servers are too busy, please try again"
// );
// }
// return response.json();
// });
// return result;
// }
Insert cell
// osmtogeojson = require("osmtogeojson@3.0.0-beta.5/osmtogeojson.js")
Insert cell
// geojson = osmtogeojson(overpassQueryResult)
Insert cell
Insert cell
// GeoJSONtoPoints = (GeoJSONfeature, parsedAnnotation) => {
// const gcps = parsedAnnotation.gcps
// const feature = GeoJSONfeature.geometry
// const transformArgs = transform.createTransformer(gcps);

// // The current version of @allmaps/transform does not yet support
// // easy conversion of geospatial GeoJSON to image GeoJSON.
// // This currently needs to be done point by point.
// // @bertspaan is working on a new version that will make this much easier!
// const transformedPolygon = feature.coordinates.map((polygon) =>
// polygon.map((point) => {
// const transformedPoint = transform.toImage(transformArgs, point);
// return [transformedPoint[0], -transformedPoint[1]];
// })
// );

// const points = transformedPolygon
// .flat()
// .map((point) => [~~point[0], ~~-point[1]].join(","))
// .join(" ");
// return points;
// }
Insert cell
// annotationParser = import('https://cdn.skypack.dev/@allmaps/annotation@1.0.0-beta.5')
Insert cell
// transform = import('https://cdn.skypack.dev/@allmaps/transform')
Insert cell
Insert cell
// viewof selectedOsmFeature = Inputs.select(geojson.features, {
// format: (feature) => feature.properties.name || feature.properties.natural,
// label: "Go to",
// value: "osmFeatures[0]"
// })
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
// import {icon} from '@severo/fork-awesome-icons'
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