Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Creating GeoJsonSource out of UI Thread raises exception #12435

Closed
milo1000 opened this issue Jul 19, 2018 · 3 comments
Closed

Creating GeoJsonSource out of UI Thread raises exception #12435

milo1000 opened this issue Jul 19, 2018 · 3 comments

Comments

@milo1000
Copy link

milo1000 commented Jul 19, 2018

Creating instance of GeoJsonSource class outside of UI Thread raises
com.mapbox.mapboxsdk.exceptions.CalledFromWorkerThreadException

Since it has nothing to do with UI itself nor View/Layer instance, and parsing GeoJson can be time consuming, this shall be considered bad design.

Android versions: 8.1
Device models: Nokia 7+
Mapbox SDK versions: 6.2.1

@tobrun
Copy link
Member

tobrun commented Jul 19, 2018

parse GeoJson on workerthread
pass that result to the main thread and create source from it

@tobrun tobrun closed this as completed Jul 19, 2018
@milo1000
Copy link
Author

parse GeoJson on workerthread

That's not the point of this issue. I don't parse GeoJSON by myself, just create GeoJsonSource from GeoJSON string like this:

GeoJsonSource geoJsonSource = new GeoJsonSource(OVERLAY_SOURCE_ID, overlaySource);

Since my overlaySource can be huge, such operation seems to be heavyweight and it's strange to do such operation within UI thread.

@tobrun
Copy link
Member

tobrun commented Jul 19, 2018

tracking optimisations to this feature in #8484

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants