Public
Edited
Nov 29, 2022
1 fork
Insert cell
Insert cell
viewof basemap = Inputs.radio(["voyager", "positron", "dark-matter"], {value: 'positron', label: "CARTO basemap"})
Insert cell
World = {
const container = yield html`<div style="height:800px;">`;
const map = (container.value = new maplibregl.Map({
//interactive: false,
boxZoom: true,
pitch: 0,
bearing: 0,
maplibreLogo: true,
container,
center: [-70.2568, 43.64],
zoom: 12,
style: 'https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json',
scrollZoom: true
}));
map.on('load', function() {
map.addSource('schools', {
'type': 'geojson',
'data': editedSchoolData
});
map.addLayer({
'id': 'schoolPoints',
'type': 'circle',
'source': 'schools',
});
});

map.on('mouseenter', 'schoolPoints', function (e) {
popup.setLngLat(e.lngLat).setHTML('<h3>' + 'Test' + '</h3>').addTo(map);
});
map.on('mouseleave', 'earthquakes', function (e) {
popup.remove();
});
}

Insert cell
Insert cell
maplibregl = require("maplibre-gl@2.1.9")
Insert cell
import {maineSchoolsGeoJson} from "f305f4a853afe835"
Insert cell
maineSchoolsGeoJson
Insert cell
editedSchoolData = {
return{
"type": "FeatureCollection",
"features":test
}}
Insert cell
test = maineSchoolsGeoJson.features.map( d => ({
type: "Feature",
properties: d.properties,
geometry: {
type: "Point",
coordinates: [d.geometry.coordinates[0], d.geometry.coordinates[1]]
}
}))
Insert cell
data = d3.json('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson')
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