ui-mapbox
ui-mapbox copied to clipboard
Load geoJSON source from file
Hi
I have a fairly large (20MB) geoJSON dataset that I want to add as a source. Reading the file from disk, then parsing and adding it does work, but it's really rather slow:
const routesFile = nodecyclerData.getFile(`routes.json`);
let routesText = await routesFile.readText();
let routes = JSON.parse(routesText);
await this.mapView.addSource(`routes`, {
'type': 'geojson',
'data': routes,
})
The docs mention a way to skip all the extra parsing: https://docs.mapbox.com/help/troubleshooting/working-with-large-geojson-data/#store-geojson-at-url. As far as I could test, this method does not seem to work for ui-mapbox. Moreover, it would require the device to go online.
Does anyone know how to deal with this?