I'm successfully retrieving a set of features from my API, when I output them to e.g. for the console it would something like this:
{type: "feature" geometry: {type: point, coordinates: array(2)}
properties: {extra properties}}
Multiple of these features are retrieved from my API and stored in the state. Currently the max amount of features retrieved are anywhere between 0 to 50 features. So I'm guessing this isn't issue with too many features needed to be rendered.
Found an example on the project GitHub page that is linked below doing something similar but they are using an url instead of a shape property like the one I'm using. Which should be capable of what im trying to according the documentation.
Link to the example: https://github.com/react-native-mapbox-gl/maps/blob/master/example/src/examples/EarthQuakes.js
Link to the documentation: https://github.com/react-native-mapbox-gl/maps/blob/master/docs/ShapeSource.md
I've also tried the several solutions found on this SO post: How do you convert normal geographic json coming from server into geoJson?
Currently my render method looks like the one provided below:
render() {
return (
<View style={styles.container}>
<MapboxGL.MapView
showUserLocation={true}
rotateEnabled={false}
style={styles.map}
ref={map => { this.map = map; }}
styleURL={MapboxGL.StyleURL.Street}
onRegionDidChange={this.onRegionDidChange}
onDidFinishLoadingMap={this.onDidFinishLoadingMap}>
<MapboxGL.UserLocation
visible={true}/>
<MapboxGL.ShapeSource
id='routeSource'
shape={{type: "FeatureCollection", features:
this.state.routes}}
type='geojson'>
<MapboxGL.CircleLayer
id="singlePoint"
style={layerStyle.singlePoint}
/>
</MapboxGL.ShapeSource>
<MapboxGL.Camera
ref={camera => {this.camera = camera;}}
zoomLevel={8}/>
</MapboxGL.MapView>
</View>
);
All the code compiles fine on both android and iOS there are no errors present either in the console or on the simulators. The expected result is that circles are rendered on the map using the features that were added to the state