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

map.addSource() should accept a POJSO

Open jfirebaugh opened this issue 11 years ago • 2 comments

(plain-old JavaScript object)

e.g.:

map.addSource("geojson", {
    "type": "geojson",
    "data": {
        ...
    }
});

jfirebaugh avatar Feb 21 '15 01:02 jfirebaugh

But map is not accepting a variable that contains the json object. In that case it throws the error: "Input data is not a valid GeoJSON object."

rjairath avatar Jun 02 '19 18:06 rjairath

@rjairath addSource will accept a variable containing a JSON object, but the variable has to point to valid GeoJSON. You can view the GeoJSON spec at geojson.org and validate and debug your GeoJSON with geojson.io.

ryanhamley avatar Jun 03 '19 21:06 ryanhamley