Published
Edited
Sep 3, 2020
Insert cell
Insert cell
Insert cell
Insert cell
ag = require('@esri/arcgis-rest-feature-layer')
Insert cell
Insert cell
moment = require('moment')
Insert cell
Insert cell
import { vl } from "@vega/vega-lite-api"
Insert cell
Insert cell
layerURL = "https://services6.arcgis.com/Bd4MACzvEukoZ9mR/ArcGIS/rest/services/county_MOHSIS_map/FeatureServer/0"
Insert cell
Insert cell
layer = ag.getLayer({url: layerURL})
Insert cell
Insert cell
lastEdit = new Date(layer.editingInfo.lastEditDate)
Insert cell
Insert cell
sinceLastEdit = moment(lastEdit).fromNow()
Insert cell
Insert cell
queryResults = ag.queryFeatures({url: layerURL, f: "geojson"})
Insert cell
Insert cell
Insert cell
Insert cell
basicGeoshape = vl.markGeoshape()
.data(queryResults.features)
.render()
Insert cell
Insert cell
choropleth = vl.markGeoshape()
.data(queryResults.features)
.encode(
vl.color({field: "properties.CASES", type: "quantitative"})
)
.render()
Insert cell
Insert cell
Insert cell
choroplethTooltipped = vl.markGeoshape()
.data(queryResults.features)
.encode(
vl.color({field: 'properties.CASES', type: 'quantitative'}),
vl.tooltip([
{field: 'properties.NAME', title: "Name"},
{field: 'properties.CASES', title: 'Cases'},
{field: 'properties.DEATHS', title: 'Deaths'},
]),
)
.render()
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