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

Support offline vector maps (MBTiles, MVT, gzipped pbf) #740

Closed
wants to merge 4 commits into from
Closed

Support offline vector maps (MBTiles, MVT, gzipped pbf) #740

wants to merge 4 commits into from

Conversation

ktzouno
Copy link

@ktzouno ktzouno commented Sep 7, 2019

Supporting OpenMapTiles offline Vector maps (MBtiles, MVT, gzipped-pbf format) with overzoom functionality.
(Related to #708 )

Test mbtiles map:
vector.mbtiles.zip

@@ -3,6 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'

dependencies {
api project(':vtm')
api project(':vtm-mvt')
Copy link
Collaborator

@devemux86 devemux86 Sep 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot load vtm-android module with extra dependencies, which may be not useful by all users.

We could handle it in separate vtm-android-mvt module, so that everyone can pick only the needed dependencies.

@devemux86
Copy link
Collaborator

Thanks for the work!

Current approach with the workers seems complicated and finding them in same class.
We could follow the former separated structure retaining library's naming:

  • MBTilesBitmapTileSource + MBTilesBitmapTileDataSource (like now)
  • MBTilesMvtTileSource + MBTilesMvtTileDataSource (in new vtm-android-mvt module)
  • They can extend MBTilesTileSource + MBTilesTileDataSource (for common fields / methods)

That way everyone can select the wanted tile source and the mvt dependencies separately if needed.

@ktzouno
Copy link
Author

ktzouno commented Sep 8, 2019

@devemux86 thanks for your fast review. I created the new vtm-android-mvt module, so the automation I introduced with the workers is not available anymore and I converted it to the architecture you suggested above.

Konstantinos Tzounopoulos added 2 commits September 8, 2019 16:37
@devemux86 devemux86 added this to the 0.12.0 milestone Sep 9, 2019
devemux86 pushed a commit that referenced this pull request Sep 9, 2019
Support offline vector maps (MBTiles, MVT, gzipped pbf)
@devemux86
Copy link
Collaborator

Thanks for the nice clean work!

Squashed and merged via a9e18a2 (with minor improvements).

@ktzouno
Copy link
Author

ktzouno commented Sep 9, 2019 via email

@ktzouno
Copy link
Author

ktzouno commented Sep 9, 2019 via email

@devemux86
Copy link
Collaborator

creating 1 MvtDecoder per thread with the ThreadLocal

Indeed that's not nice.

MvtTileDecoder uses a cached MapElement for performance reasons.
But we had not any synchronization issues with all other mvt tile sources.

@devemux86
Copy link
Collaborator

Actually that is how overzoom works and specified for online tile sources, where all above tiles do exist.

Requires to pre-define on which zoomLevel Overzooming should be applied

That is expected and known for all online tile sources according to their documentation.

a query that loads all the tiles for that spot on all zoomLevels

Some providers have small overzoom levels and heavy tiles, so that could be bad for performance.

Databases are certainly different from online requests.
VTM overzoom was implemented with the 2nd concept.

@ktzouno
Copy link
Author

ktzouno commented Sep 9, 2019

Requires to pre-define on which zoomLevel Overzooming should be applied

That is expected and known for all online tile sources according to their documentation.

Lets assume we have an mbtiles DB for my city:

Area zoomLevels
My City 0-14 (guaranteed)
My Country 0-10 (maybe)
My Continent 0-4 (maybe)

So assuming that the app allows the user to zoom anywhere on the planet, the available tiles' zoomLevel will be much less than 14.
14 is the guaranteed zoomLevel assuming that the user Overzooms inside the My City area.

@ktzouno
Copy link
Author

ktzouno commented Sep 9, 2019

a query that loads all the tiles for that spot on all zoomLevels

Some providers have small overzoom levels and heavy tiles, so that could be bad for performance.

I didn't spend much time on the performance. In case it wasn't clear, my overzooming-query won't "process" all the tiles it gets back from all zoomLevels, only the max-zoomLevel tile.

But I'd check 3 Overzooming modes to assess their performance. e.g. on max-zoomLevel 14 DB:

  1. One query for the current zoomLevel, one per zoomLevel till the 0 one => can lead to 14 queries per tile.
  2. One query for the current zoomLevel, one more query to Overzoom if needed => 2 queries per tile (I implemented this)
  3. One query for all zoomLevels => 1 query per tile.

@devemux86
Copy link
Collaborator

I was talking about online tile sources, not offline MBTiles, they're different concepts.

If test the various online mvt tile sources, can zoom / scroll anywhere in the planet beyond OMT overzoom 14 and the map should fill with content from above levels step by step.
Though because the overzoom level is small, their tiles are usually heavy and not have much performance compared to e.g. OSciM tiles.

@devemux86 devemux86 changed the title Supporting OpenMapTiles offline Vector maps (MBtiles, MVT, gzipped-pbf format) Support offline vector maps (MBTiles, MVT, gzipped pbf) Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants