Reputation: 1
Mapbox
default
0.71.8
iOS, Android
@rnmapbox/maps
version10.1.31
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
Lib used: "@mapbox/mapbox-sdk": "^0.16.1" "@rnmapbox/maps": "^10.1.31"
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.
Expecting : Clustering should work with the "Point" and "Polygon".
Upvotes: 0
Views: 21