Hello, as the title says I am having trouble converting ring data to geoJSON.
I had a look at the Geometry class from the ArcGIS javascript library, but I don't understand how to use it to convert the ring data to geoJSON.
The array of rings that I am working with looks like this:
rings = [
[
-13441425.32511117,
4491520.711015136
],
[
-13440894.1920939,
4491511.685098792
],
[
-13440922.71925878,
4490494.010447212
],
[
-13441438.25014971,
4490494.010447212
],
[
-13441425.32511117,
4491520.711015136
]
]
Any help would be greatly appreciated!
Hi @naglane ,
The following code snippet converts rings to polygonJson (geojson):
const rings = [
[
[
-13441425.32511117,
4491520.711015136
],
[
-13440894.1920939,
4491511.685098792
],
[
-13440922.71925878,
4490494.010447212
],
[
-13441438.25014971,
4490494.010447212
],
[
-13441425.32511117,
4491520.711015136
]
]
];
const polygon = new Polygon({
rings: rings,
spatialReference: { wkid: 4326 }
});
I hope that's helpful.