toPolygon
Converts a MapsIndoors MPLatLngBounds object to the GeoJSON Polygon Mapbox's tile store wants for a tile region's geometry.
The ring is closed — five points, first equal to last, as RFC 7946 requires — and wound counter-clockwise: south-west, south-east, north-east, north-west, back to south-west.
The bounds are converted, never adjusted. MPIMapProviderBaseMapCache makes the core SDK responsible for the area so that every map provider caches the same one, so there is no clamping, buffering or normalisation here.
Bounds whose south-west longitude exceeds their north-east longitude — a region straddling ±180° — produce a ring that traces the long way round the globe. Splitting into a MultiPolygon would be the fix, and is deliberately not done: the bounds come from a single venue's footprint plus a buffer and cannot realistically straddle the antimeridian. The case is logged rather than silently mis-cached. Poles need no handling — a degenerate ring at ±90° is valid GeoJSON, and Mapbox's Web Mercator tiling tops out at ±85.05° regardless.
Return
a Polygon object covering exactly those bounds
Parameters
a MPLatLngBounds object to convert