Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load geoJSON source from file #59

Open
vhdirk opened this issue Jan 12, 2022 · 0 comments · May be fixed by #65
Open

Load geoJSON source from file #59

vhdirk opened this issue Jan 12, 2022 · 0 comments · May be fixed by #65

Comments

@vhdirk
Copy link
Contributor

vhdirk commented Jan 12, 2022

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?

@vhdirk vhdirk linked a pull request Feb 1, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant