Published
Edited
Nov 30, 2021
1 star
Insert cell
Insert cell
Insert cell
viewof map = {
unfoldedMap.setMapEventHandlers({
onLoad: () => {
unfoldedMap.setViewState({
longitude: -96.4247,
latitude: 31.51073,
zoom: 1
});
}
});
yield unfoldedMap.iframe;
}
Insert cell
Insert cell
unfoldedMap = mapSDK.createMap({
embed: true,
appendToDocument: false,
width: width,
height: 600,
});
Insert cell
Insert cell
Insert cell
worldLakes = FileAttachment("world-lakes.json").json()
Insert cell
majorWorldRivers = FileAttachment("world-rivers.json").json()
Insert cell
Insert cell
unfoldedMap.addDataset({
uuid: 'world-lakes',
label: 'World Lakes',
data: JSON.stringify(worldLakes)
}, autoCreateLayers)
Insert cell
unfoldedMap.addDataset({
uuid: 'world-rivers',
label: 'World Rivers',
data: JSON.stringify(majorWorldRivers)
}, autoCreateLayers)
Insert cell
Insert cell
Insert cell
Insert cell
worldCities = FileAttachment('world-cities.csv').csv()
Insert cell
worldCitiesFileBlob = FileAttachment('world-cities.csv').blob()
Insert cell
worldCitiesCSV = worldCitiesFileBlob.text()
Insert cell
Insert cell
viewof worldCitiesTable = Inputs.table(worldCities, {sort: 'cityName'})
Insert cell
Insert cell
Insert cell
unfoldedMap.addDataset({
uuid: 'world-cities',
label: 'World Cities',
data: worldCitiesCSV
}, false) // don't autoCreateLayers
Insert cell
Insert cell
unfoldedMap.addLayer({
id: 'world-cities-point-layer',
type: 'point',
config: {
dataId: 'world-cities',
label: ' World Cities',
columns: {
'lat': 'latitude',
'lng': 'longitude'
},
isVisible: true,
}
})
Insert cell
Insert cell
Insert cell
Insert cell
mapSDK = import('https://unpkg.com/@unfolded/map-sdk@0.3.1/dist/index.js?module')
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