The addLayer('geojson') (and associated internal addGeoJSONLayer()) method expects a GeoJSON URL to be provided. This adds a layer to the map, which then makes a separate request to the URL to load in GeoJSON data from it.
There are cases where you already have a GeoJSON string, and you just want to pass that in, without the need to load it from a URL. Currently, the only way to handle that is to convert the GeoJSON to WKT (which requires another library like Wicket) and then use addLayer('wkt').
This came of the discussion in: https://github.com/farmOS/farmOS-client/pull/350 - because Field Kit was using addLayer('geojson') to load the "all areas" geometries directly from farmOS, but with the move to OAuth2 this will no longer work (because there won't be a session cookie saved that gets passed to that endpoint automatically). So: Field Kit will need a way to add a GeoJSON layer to a map by passing a GeoJSON string to it, not a URL.
The
addLayer('geojson')
(and associated internaladdGeoJSONLayer()
) method expects a GeoJSON URL to be provided. This adds a layer to the map, which then makes a separate request to the URL to load in GeoJSON data from it.There are cases where you already have a GeoJSON string, and you just want to pass that in, without the need to load it from a URL. Currently, the only way to handle that is to convert the GeoJSON to WKT (which requires another library like Wicket) and then use
addLayer('wkt')
.This came of the discussion in: https://github.com/farmOS/farmOS-client/pull/350 - because Field Kit was using
addLayer('geojson')
to load the "all areas" geometries directly from farmOS, but with the move to OAuth2 this will no longer work (because there won't be a session cookie saved that gets passed to that endpoint automatically). So: Field Kit will need a way to add a GeoJSON layer to a map by passing a GeoJSON string to it, not a URL.(https://github.com/farmOS/farmOS-client/pull/350#issuecomment-632023703)