Flipping Coordinates
flipCoordinates
The flipCoordinates function swaps the coordinates of a point, ring, polygon, or multipolygon. This is useful, for example, when converting between coordinate systems where the order of latitude and longitude differs.
Input Parameters
coordinates— A tuple representing a point(x, y), or an array of such tuples representing a ring, polygon, or multipolygon. Supported input types include:- Point: A tuple
(x, y)wherexandyare Float64 values. - Ring: An array of points
[(x1, y1), (x2, y2), ...]. - Polygon: An array of rings
[ring1, ring2, ...], where each ring is an array of points. - Multipolygon: An array of polygons
[polygon1, polygon2, ...].
- Point: A tuple
Returned Value
The function returns the input with the coordinates flipped. For example:
- A point
(x, y)becomes(y, x). - A ring
[(x1, y1), (x2, y2)]becomes[(y1, x1), (y2, x2)]. - Nested structures like polygons and multipolygons are processed recursively.