visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.85k stars 1.36k forks source link

Circle Layer works, but Fill or Line layer does not. Can't display polygons on the map. [Bug] #2242

Closed giovanniincammicia closed 1 year ago

giovanniincammicia commented 1 year ago

Description

I have a simple map where I want to display a few polygons from geojson data. Here is my code: https://sharetext.me/npepoog4pl

I use this mapstyle: mapbox://styles/mapbox/streets-v11

I can see the point, but not the polygon. I'm sure the coordinates are correct, because I copied them from a polygon I drawn directly on the map with @mapbox/mapbox-gl-draw.

I tried commenting out the different layers and changing the configuration a bit, but I can't display the polygon in any way.

Expected Behavior

I expected to see the point AND the polygon. I only see the point.

Steps to Reproduce

Environment

Logs

No response

Pessimistress commented 1 year ago

Same as #2228?

giovanniincammicia commented 1 year ago

Hi, thank you for the quick response. That looks very promising, I tried switching between the map styles and applying projection={{ name: 'mercator' }} to my code, but still doesn't work. :(

Pessimistress commented 1 year ago

Your data is not a valid GeoJSON. Polygon features are supposed to be number[][][]. Please check the GeoJSON specification.