mapbox/turf-swift

BoundingBox mixes up its corners

1ec5 opened this issue · 0 comments

1ec5 commented

The BoundingBox struct encodes and decodes northwest and southeast coordinates, in that order, whereas the GeoJSON specification expects southwest and northeast coordinates:

try container.encode(northWest.codableCoordinates)
try container.encode(southEast.codableCoordinates)

If an application decodes GeoJSON, the in-memory representation is incorrect. If an application creates a BoundingBox programmatically and encodes it to GeoJSON, the GeoJSON is incorrect.

BoundingBox was probably copied from MapboxDirections’ CoordinateBounds type, which was fixed in mapbox/mapbox-directions-swift#348.

/cc @mapbox/navigation-ios @frederoni