I am trying to draw polygon on map but I couldn't find a single example that shows how to do it. This question has been asked before but no correct answer was provided.
const GeoJson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[10.9313965, 55.9430478],
[10.9643555, 54.5720617],
[12.9089355, 54.5720617],
[12.8979492, 55.8383135],
[12.3376465, 56.2250313],
[10.9313965, 55.9430478],
],
],
},
},
],
};
...
<MapboxGL.MapView style={{ flex: 1 }} styleJSON={MapStyle}>
<MapboxGL.ShapeSource id={'some-feature'} shape={GeoJson}>
<MapboxGL.LineLayer
sourceID="some-feature"
id="some-feature-line"
style={{
lineColor: '#ffffff',
lineWidth: 10,
}}
/>
<MapboxGL.FillLayer
sourceID="some-feature"
id="some-feature-fill"
style={{
fillColor: ['interpolate', ['linear'], ['zoom'], 0, '#eeddbb', 2, '#0daa00', 3, '#bbbbee'],
}}
/>
</MapboxGL.ShapeSource>
</MapboxGL.MapView>
even though I am providing the map with coordinates of a polygon its not showing it on the map. Also, I dont want to just show a polygon based on coordinates but also draw it.