oscarfonts / mapbox-gl-cordova-offline

Offline vector maps in Cordova using Mapbox GL JS
Other
60 stars 36 forks source link

Initial port to mapbox-gl-js 0.43.0 #12

Closed jpilet closed 6 years ago

jpilet commented 6 years ago

This is a start on #3. I do not think it is ready to be merged, but I need help to finish.

I refactored the loading so that de-compression is done right after the SQL query. Then the tile url is replaced with a data uri, so that existing mapbox-gl-js loading code works without modification.

Now npm run flow does some typechecking.

Loading basically works, but no label is displayed. I had to modify mapbox-gl-js in order to have some result:

regarding the last one, this is clearly not the correct solution since we get no label displayed.

@oscarfonts can you help with this?

oscarfonts commented 6 years ago

Found it!

This "instanceof" check here doesn't work when loading tiles from local database (it does work with builtin VectorTile source): https://github.com/JpmGuides/mapbox-gl-js/blob/master/src/source/worker_tile.js#L159

I can't explain why this happens.

But just changing the condition for an equivalent one fixes it: if (bucket.hasOwnProperty('collisionBoxArray'))

Please fix it in your mapbox-gl-js fork.

Thanks!

jpilet commented 6 years ago

you are right, that's very strange. Thanks for spotting this.

image

I updated my mapbox-gl-js fork, see https://github.com/JpmGuides/mapbox-gl-js/commit/f852a6d5b3d1b0609d5de25a2fc5e0eb72c428a0