Published
Edited
Nov 24, 2020
3 stars
Insert cell
Insert cell
input = ({
xmin: -5699508.518003281,
ymin: -3398633.586947236,
xmax: -5699354.4496181905,
ymax: -3398542.967267246,
spatialReference: { wkid: 102100 },
geometry: {
rings: [
[
[-5699459.998405264, -3398563.420143949],
[-5699447.457955314, -3398561.031486816],
[-5699437.9033267815, -3398573.1240635524],
[-5699444.92000711, -3398576.707049252],
[-5699440.889148198, -3398585.5152224307],
[-5699451.787396368, -3398589.695372414],
[-5699459.998405264, -3398563.420143949]
]
],
spatialReference: { wkid: 102100 }
},
symbol: {
color: [125, 125, 125, 255],
outline: {
color: [125, 125, 125, 255],
width: 0.75,
type: "esriSLS",
style: "esriSLSSolid"
},
type: "esriSFS",
style: "esriSFSSolid"
}
})
Insert cell
Insert cell
p4 = require('https://unpkg.com/proj4@2.6.3/dist/proj4.js').then(p4 => {
p4.defs(
"EPSG:3857",
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"
);
p4.defs("EPSG:4326", "+proj=longlat +datum=WGS84 +no_defs");
return p4;
})
Insert cell
Insert cell
projected = {
let copy = JSON.parse(JSON.stringify(input));
copy.geometry.rings[0] = copy.geometry.rings[0].map(coord =>
p4('EPSG:3857', 'EPSG:4326', coord)
);
return copy;
}
Insert cell
Insert cell
converted = {
let converted = utils.arcgisToGeoJSON(projected);
delete converted.coordinates;
converted.properties = {};
return converted;
}
Insert cell
md`Here's that converted thing as a GeoJSON string.`
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more