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

[Bug]: Geting Error "mapbox::util::bad_variant_access" while cluster is enable for the "Point" and "Polygon" geo json data. #3662

Open
vishalTrooTech opened this issue Oct 21, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@vishalTrooTech
Copy link

vishalTrooTech commented Oct 21, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.71.8

Platform

iOS, Android

@rnmapbox/maps version

10.1.31

Standalone component to reproduce

import MapboxGL, { MapView } from "@rnmapbox/maps";
import React from "react";

const MapScreen = () => {
  const GEO_JSON = [
    //link attched in description
  ];

  return (
    <MapView requestDisallowInterceptTouchEvent style={{ flex: 1 }}>
      <MapboxGL.ShapeSource
        id="hangoutMarkers"
        onPress={() => {}}
        cluster
        clusterRadius={50}
        clusterMaxZoomLevel={16}
        shape={GEO_JSON}
      >
        <MapboxGL.SymbolLayer
          id="singlePoint"
          filter={["==", ["geometry-type"], "Point"]}
          style={{
            iconImage: ["get", "icon"],
            iconSize: 0.2,
            iconAllowOverlap: false,
          }}
        />
        <MapboxGL.SymbolLayer
          filter={["==", ["geometry-type"], "Point"]}
          id="pointCount"
          style={{
            textField: [
              "format",
              ["concat", ["get", "point_count"], "\n"],
              {},
              ["concat"],
              { "font-scale": 0.8 },
            ],
            textSize: 12,
            textPitchAlignment: "map",
          }}
        />
        <MapboxGL.CircleLayer
          id="clusteredPoints"
          belowLayerID="pointCount"
          filter={["has", "point_count"]}
          // style={layerStyles.clusteredPoints}
        />
        <MapboxGL.FillLayer
          id="polygonFillLayer"
          filter={["==", ["geometry-type"], "Polygon"]}
          style={{
            fillColor: "black",
          }}
        />
        <MapboxGL.LineLayer
          id="polygonLineLayer"
          filter={["==", ["geometry-type"], "Polygon"]}
          style={{
            lineColor: "black",
            lineWidth: 2,
            lineDasharray: [1, 0],
          }}
        />
      </MapboxGL.ShapeSource>
    </MapView>
  );
};

export default MapScreen

Observed behavior and steps to reproduce

When multi type features is there (Point and Polygon) in GEO JSON and clustering is enable from the MapboxGL.ShapeSource then App going to crash and giving error for the "bad variant access". When I am commenting the clustering props in the MapboxGL.ShapeSource then is working and show the Point and Polygon view on the Map view.

Expected behavior

Clustering should work with the "Point" and "Polygon".

Notes / preliminary analysis

No response

Additional links and references

GEO JSON Link : https://drive.google.com/file/d/17vgyPMDGxT_4uIVBndTXmh0WfIDb3vZn/view?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant