react-mapbox-gl icon indicating copy to clipboard operation
react-mapbox-gl copied to clipboard

"Error: Input data is not a valid geojson object" when moving a polygon

Open Mathieu-R opened this issue 6 years ago • 4 comments

Hello,

I tried to move a polygon created with <Layer><Feature /></Layer>.
When I move the polygon I fall on this error :
image

Here's the code :

renderExclusionsZones (exclusionsZones) {
    if (exclusionsZones) {
      console.log(exclusionsZones);
      return (
        <Layer type="fill" paint={{'fill-color': '#FFF', 'fill-opacity': 0.8}}>
          {exclusionsZones.map((zone, index) => (
            <Feature
              key={index}
              coordinates={[[
                [zone.ul.lng, zone.ul.lat],
                [zone.ur.lng, zone.ur.lat],
                [zone.lr.lng, zone.lr.lat],
                [zone.ll.lng, zone.ll.lat]
              ]]}
              draggable={true}
              onDragEnd={evt => this.props.moveExclusionZone(evt, index)}
            />
          ))}
        </Layer>
      );
    }
  }

Maybe I miss something ?

Thanks.

Mathieu-R avatar Feb 27 '18 09:02 Mathieu-R

Having the same issue with almost exactly the same code. According to the examples it should work just fine.

hughlomas avatar Mar 26 '18 17:03 hughlomas

Any solution to this problem? I request GeoJSON data from the server using fetch api. The fetch returns a Promise (PromiseStatus: resolved PromiseValue: object). The object is a FeatureCollection. The console prints out the same error as above: not a valid GeoJSON object. at Actor.receive (mapbox-gl-0.44.1.js:sourcemap:501)

LeslieK avatar Jun 05 '18 03:06 LeslieK

Same problem here. Any thoughts on a fix?

stdmn avatar Feb 10 '19 17:02 stdmn

same problem with mapbox

JorgeARZ avatar Dec 22 '23 23:12 JorgeARZ