React-map-gl: i cant get my layer to show

Created on 3 Apr 2019  路  3Comments  路  Source: visgl/react-map-gl

im not sure what im doing wrong, already tried a bunch of things except for the map controller maybe, only spend a couple hours there and still couldnt get my layer to show...

here is my component
gist

usually when i used to have this problem with the common mapbox-gl-js i would just move the layer im using to the top and that would do the trick but that is already how it is with this component...

anyone could point me in any direction? i tried to use the geojson example and any help would be awesome

Most helpful comment

Did you figure this out @sicksid? I am also having issues with a layer not showing.

https://xkcd.com/979/

All 3 comments

Did you figure this out @sicksid? I am also having issues with a layer not showing.

https://xkcd.com/979/

I found the solution to my problem. I was trying to display a "symbol" layer with a custom image. I had forgotten to load the image and add it to the map, like so:

import ReactMapGL from 'react-map-gl'
import myImage from '../../assets/images/myImage.png'

<ReactMapGL
  onLoad={() => {
    if (!this.map) return
    const map = this.map.getMap()
    map.loadImage(myImage, (error, image) => {
      if (error) return
      map.addImage('myImage', image)
    })
} }
>
</ReactMapGL>

@draperunner i did, i closed the issue because it was a problem on my end, basically i was trying to render a dataset that contained broken polygons, i didnt realized until i tested with data i knew was right instead of data generated at the moment...

so i would say for whoever faces this issue, first verify that your data is right otherwise Mapbox is correct to not show broken polygons

Was this page helpful?
0 / 5 - 0 ratings