Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while adding a filllayer made of polygons to a GeoJSONSource with source property 'cluster' = true #2143

Open
jumbopilot opened this issue Mar 13, 2024 · 0 comments
Labels
bug 🪲 Something is broken!

Comments

@jumbopilot
Copy link

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, mapbox::feature::feature_collection<double, std::__1::vector>> const&, mbgl::Immutablembgl::style::GeoJSONOptions const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>)

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.

@jumbopilot jumbopilot added the bug 🪲 Something is broken! label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

1 participant