Public
Edited
Dec 5, 2022
Insert cell
Insert cell
Insert cell
dataUrl = {
const blob = new Blob([JSON.stringify(geojson)], {
type: "application/json"
});
const url = URL.createObjectURL(blob);
return url;
}
Insert cell
// note the JS API expects a GeoJSON feature collection(?)
geojson = ({
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: decoded
}
]
})
Insert cell
decoded = polyline.polylineToGeoJSON(polylineData)
Insert cell
polylineData = "ksveFpi`iVq@x@IBMKKSEQ[CQMEh@WxAGLIBGACIkAsCS[WOa@EK@EFGJAPENcAhA]j@Id@CPGNg@hEEDERI|BMp@M|AZjLKj@Yb@wAzAi@v@k@|AUbB_@rAQf@g@|@MZkApBi@v@}ArCwExGKf@@RBP\\x@P~@JTH`@DHJ|@ZpAXdB@VPz@Rn@jAxADJCP^Xx@xA^bAP^Vx@Nl@DL@LPNf@t@h@d@x@ZrA^z@\\|@XfB`@pBt@vBj@pCbA\\h@Nt@JrA?jAHnAH`ATl@LTTVf@Vh@PdCj@VLf@l@fAv@ZJhALv@EfAMb@Fj@Zl@p@`@|@Nr@Vl@fB~Bl@bAHTj@dAT\\p@lB^zADh@?v@OtIGr@S`AUj@QZg@h@UNu@Z{Cl@}@Ha@Le@VYX]f@Yl@EBG@GCEGqA_@q@[o@c@a@Q_@IiAs@o@S_@Wq@Me@g@]q@a@WWGYDQJUb@G^OVs@|Ak@l@}@h@k@Rw@l@q@Vu@h@_@Pg@XS\\IFu@Rc@DWEUKg@]a@KaADKCc@k@]Qe@EcBEk@Q]Q}Ai@]Ge@JQCS_@Cg@PaCHm@R{B`@{AR_@`@m@r@mAZo@f@oAr@aCNcALsALuCJ}@JmDLqB@uCDq@LoDAgABi@AoCHcBCo@E_@[cBKY]m@OUQQEIAMDK`@g@r@kATYND\\^b@Z`A`@nBd@fBl@zAVpDpAxA`@~B~@FHb@rAH~@B~ATfCTr@V^\\Vt@Z|@PfA\\n@^Z^f@`@j@Vb@Hz@FdBOh@@l@X^\\Zb@Tf@XfAZp@`BnBvB`EFFXn@d@|ANjABx@SpJObAOp@_@x@]`@y@h@a@PaDh@q@Bw@Vi@b@MPWb@K^MLI@]QK?m@SaBaAsBy@m@_@WKa@WgAa@_@[K[SYa@SSAWFGJYXCd@KX_@l@Sf@e@l@gCpAUNsB~@u@b@o@f@ULcA\\WCWGi@[UIYCo@JMA[WEMUO_Dk@q@QgBk@y@MU_@YMGKCg@?Q`@kDF[B_@Z_BT_@h@o@r@eAv@aBRm@He@Nc@^eBPeBFyAJmBJoEF}@@kAFo@FwCJiB?uADw@@}C"
Insert cell
Insert cell
JS_API_VERSION = 4.25
Insert cell
JS_API_BASE_URL = `https://js.arcgis.com/${JS_API_VERSION}/@arcgis/core`
Insert cell
// NOTE: This key will only work for this notebook, please acquire your own at: https://developers.arcgis.com/api-keys
JS_API_KEY = "AAPKeaa067e241884f1f8ea72a5593cb8821aRuJV_aPxvhDXViKpdrzEOnB8RKhvKVPogv2Ry0d5AlAMEqq8S66zKkwHWHFBZKg"
Insert cell
getImport = async (path, ext = ".js") =>
await (
await import(`${JS_API_BASE_URL}${path}${ext}`)
).default
Insert cell
ArcGIS = {
const imports = await Promise.all(
[
"/config",
"/layers/GeoJSONLayer",
"/Map",
"/views/MapView",
"/renderers/SimpleRenderer",
"/symbols/SimpleLineSymbol"
].map((d) => getImport(d))
);

const importNames = [
"Config",
"GeoJSONLayer",
"Map",
"MapView",
"SimpleRenderer",
"SimpleLineSymbol"
];

const ArcGIS = Object.fromEntries(imports.map((d, i) => [importNames[i], d]));

const { Config } = ArcGIS;
Config.apiKey = JS_API_KEY;

if (!Config._style) {
const href = await require.resolve(
`${JS_API_BASE_URL}/assets/esri/themes/light/main.css`
);
document.head.appendChild(
(Config._style = html`<link href=${href} rel=stylesheet>`)
);
}

return ArcGIS;
}
Insert cell
polyline = require("@placemarkio/polyline")
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