-
Notifications
You must be signed in to change notification settings - Fork 91
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
Support offline vector maps (MBTiles, MVT, gzipped pbf) #740
Conversation
vtm-android/build.gradle
Outdated
@@ -3,6 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven' | |||
|
|||
dependencies { | |||
api project(':vtm') | |||
api project(':vtm-mvt') |
There was a problem hiding this comment.
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.
Thanks for the work! Current approach with the workers seems complicated and finding them in same class.
That way everyone can select the wanted tile source and the mvt dependencies separately if needed. |
@devemux86 thanks for your fast review. I created the new |
Minor variable renames
Support offline vector maps (MBTiles, MVT, gzipped pbf)
Thanks for the nice clean work! Squashed and merged via a9e18a2 (with minor improvements). |
Seems that GeometryBuffer is not thread safe, so the setOrCheck() method throws: https://github.com/mapsforge/vtm/blob/master/vtm/src/org/oscim/core/GeometryBuffer.java#L418
Maybe it can be resolved in a better way that creating 1 MvtDecoder per thread with the ThreadLocal .
On 09.09.19, 11:50, "Emux" <[email protected]> wrote:
@devemux86 commented on this pull request.
In vtm-android-mvt/src/org/oscim/android/mvt/tiling/source/mbtiles/MBTilesMvtTileDataSource.java:
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.zip.GZIPInputStream;
+
+public class MBTilesMvtTileDataSource extends MBTilesTileDataSource {
+ private final static List<String> SUPPORTED_FORMATS = Arrays.asList("pbf");
+
+ public static final String WHERE_FORMAT = "zoom_level=%d AND tile_column=%d AND tile_row=%d";
+
+ private final String mLocale;
+
+ private final ThreadLocal<MvtTileDecoder> mThreadLocalMvtTileDecoders = new ThreadLocal<MvtTileDecoder>() {
Why the need of ThreadLocal for the decoder?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
There are 2 drawbacks in the Overzoom for the Online Tiles:
# Requires to pre-define on which zoomLevel Overzooming should be applied – but zoomLevels closer to 0 will contain tiles for most of the planet, while bigger zoomLevels will be optimized for the area that the App cares about.
# Will try once per zoomLevel to get a tile. So theoretically if overzooming from zoomLevel 14 could trigger 14 DB queries.
With my implementation when the App tries to load a tile that doesn’t exist, no matter what the zoomLevel is, it will try to Overzoom with a query that loads all the tiles for that spot on all zoomLevels.
Example: if a tile in zoomLevel 14 is not found, the Overzoom will request the equivalent tiles on zoomlevels 13, 12, 11,…, 0 all in the same query, and use “ORDER BY zoomLevel DESC LIMIT 1” to get the “best” tile.
On 09.09.19, 12:15, "Emux" <[email protected]> wrote:
I wonder if overzoom could be handled like we do already in online tile sources?
e.g. see OpenMapTilesMvtTileSource
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Indeed that's not nice.
|
Actually that is how overzoom works and specified for online tile sources, where all above tiles do exist.
That is expected and known for all online tile sources according to their documentation.
Some providers have small overzoom levels and heavy tiles, so that could be bad for performance. Databases are certainly different from online requests. |
Lets assume we have an mbtiles DB for my city:
So assuming that the app allows the user to zoom anywhere on the planet, the available tiles' zoomLevel will be much less than 14. |
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:
|
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. |
Supporting OpenMapTiles offline Vector maps (MBtiles, MVT, gzipped-pbf format) with overzoom functionality.
(Related to #708 )
Test mbtiles map:
vector.mbtiles.zip