Skip to content

Commit

Permalink
refactor: Added handling for additional geometry types in Arcade expr…
Browse files Browse the repository at this point in the history
…ession.
  • Loading branch information
JeffJacobson committed Dec 16, 2024
1 parent 6fb5903 commit 1a9c91d
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,30 @@ function xyWebMercatorToWgs1984(xy) {
}

function webMercatorToWgs1984(geom) {
var point = null;
if (geom.type == "Point") {
// Web Mercator coordinates
var xWebMercator = geom.x;
var yWebMercator = geom.y;

var wgsXY = xyWebMercatorToWgs1984([xWebMercator, yWebMercator]);
point = geom
} else if (geom.type == "Polyline") {
point = geom.paths[0][0]
} else if (geom.type == "Polygon") {
point = geom.rings[0][0]
} else if (geom.type == "Multipoint") {
point = geom.points[0]
}

return {
x: wgsXY[0],
y: wgsXY[1],
};
if (point == null) {
return null;
}

return null;
// Web Mercator coordinates
var xWebMercator = point.x;
var yWebMercator = point.y;

var wgsXY = xyWebMercatorToWgs1984([xWebMercator, yWebMercator]);

return {
x: wgsXY[0],
y: wgsXY[1],
};
}

0 comments on commit 1a9c91d

Please sign in to comment.