nativescript-community / nativescript-community/ui-mapbox

Load geoJSON source from file

Open
#59 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
38
Forks
26
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mapView.addSource call and review ui-mapbox's source-handling entry points, using the local-file flow through getFile and readText as the reproduction. Compare this with the linked Mapbox large-GeoJSON guidance; done means a local 20MB GeoJSON source can be added without requiring network access or manual JSON parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.