Crash while adding a filllayer made of polygons to a GeoJSONSource with source property 'cluster' = true
Environment
- Xcode version: Version 15.2 (15C500b)
- iOS version: iOS17
- Devices affected: iPhone15
- Maps SDK Version: 11.2.0 (same behavior with 11.1.0)
Observed behavior and steps to reproduce
Create a FillLayer using
// geoJSONSource
var geoJSONSourcePolygons = GeoJSONSource(id: "Airspace")
let path = Bundle.main.path(forResource: "polygons-xa", ofType: "geojson")
let urlGeoJSON = URL(fileURLWithPath: path!)
// Setting the `data` property with a url pointing to a GeoJSON document
geoJSONSourcePolygons.data = .string(urlGeoJSON.relativePath)
// Alternative#1
// Disable clustering for this source
geoJSONSourcePolygons.cluster = false // leads to no crash
// Alternative#2
// Enable clustering for this source
geoJSONSourcePolygons.cluster = true // leads to a crash
Crash in mbgl::style::GeoJSONData::create(std::__1::variant<mapbox::geometry::geometry<double, std::__1::vector>, mapbox::feature::feature
Expected behavior
No crash in Alternative#2
Notes / preliminary analysis
The used FillLayer: var unclusteredLayer = FillLayer(id: "user-polygons-layer", source: geoJSONSourcePolygons.id)
The assigned data: var featureCollection: FeatureCollection? do { let data = try Data(contentsOf: urlGeoJSON) // Attempt to decode GeoJSON from file bundled with application featureCollection = try JSONDecoder().decode(FeatureCollection.self, from: data) } catch { print("MapBox: GeoJson: failed to add features: (error.localizedDescription)") }
geoJSONSourcePolygons.data = .featureCollection(featureCollection!)
Additional links and references
[Warning, maps-core]: {}[ParseTile]: Missing closing point in polygon feature. The GeoJSON specification requires the first and last points of polygons to be identical. The missing last point was added based on the first one to avoid rendering errors.