-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
How can I manually tell the TileLayerOptions to load and paint a tile? #966
Comments
Isn't this just the same issue as 963? |
Yeah, I can close it if you want (as duplicate), but it was to attract attention because no-one had answered, so I wasn't sure if anybody had actually seen it, or no-body knew. That's why it has a 'Discussed in' header. |
The issue also confuses me, as typically grey tiles are just transparent tiles that aren't available yet aren't they...so what's actually trying to be achieved ? |
Yeah, sorry, should've clarified. This is for my plugin that handles caching. A user wanted to preload a whole area after it had been downloaded (JaffaKetchup/flutter_map_tile_caching#12) to totally avoid the grey tiles (which still appeared even if the tile was cached/downloaded already because of the time to lookup, fetch from the caching database and paint). I suggested that preloading a whole area would be unnecessary and could cause extreme performance issues (if 20000 tiles (currently max number of cached tiles allowed) were shown, the map would be incredibly laggy), so the idea is to automatically get the nearest tiles in each direction before the user scrolls there. Therefore I need to paint a tile before it actually becomes visible, the topic of this issue/discussion. |
I've certainly played with preloading tiles (iirc I preloaded an extra tile the user was panning to). But I had to edit the tile layer code myself around the tileRange.min.y for loop (which looks partially what you are trying already)...Only thing I can think of is to have your own tile_layer code (or have it as part of the plugin), but maybe that's an issue. Just thinking though (taking a quick scan of the plugin), do you need to use a database, why not just use a file cache ? (just wondering if that's faster to get around the problem another way). |
Yeah, I hoped I wouldn't have to edit the code in this package. |
Actually, I've reconsidered. Perhaps using a file method would be better. I can still find some code from one of my previous attempts at #798, so @ibrierley, do you think using a file method would be quicker? |
I suspect it "may" be :D, I've been using await
DefaultCacheManager().putFile() await
DefaultCacheManager().getFileFromCache() with
https://pub.dev/packages/flutter_cache_manager as its felt relatively
straightforward to implement (there's also await
DefaultCacheManager().getSingleFile(url) which I'm using);
…On Sat, Jul 10, 2021 at 9:22 AM Luka S ***@***.***> wrote:
Actually, I've reconsidered. Perhaps using a file method would be better.
I can still find some code from one of my previous attempts at #798
<#798>, so @ibrierley
<https://github.com/ibrierley>, do you think using a file method would be
quicker?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#966 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5YN5K5YNU3VIDRAGWK42LTW77L3ANCNFSM5ADBWIFA>
.
|
That package looks good at first glimpse, but this worries me:
I need to not store in app cache, because the OS deleting map tiles could have bad consequences (extreme example: hiker downloads an area, without the hiker knowing, the OS deletes it, the hiker gets stuck on a mountain with no signal). I also need to have multiple caching spaces to keep a functionality I recently added. This may be solvable if I specify where else to put it? And surely by using a database, it won't make a difference to the time again. Although this package has nice features built-in like having an expiry, I may have to use network_to_file_image, and make that expiry functionality another way using metadata of some sorts? But yeah, I probably will have a go with this, to see if it is indeed faster. Hopefully, it'll cut down on my library's size as well (less code). I'll try the package you mentioned first, but I feel I may need to use that other library instead. Thanks for the suggestion! However, in the event that neither of these two options is faster, I'll still need to do the original purpose of this issue, so I'm leaving this issue open for that. |
I've done the basics required, and unfortunately, I can't see that much of a difference. I'll still have to do this, but a way might be to make the map bigger than normal, so it overflows the visible area? |
Ok, so that doesn't work very well either. So the question still stands, 'How can I manually tell the TileLayerOptions to load and paint a tile?' |
Hi there, |
Tbh, given the sluggish turnaround of changes here anyway, I'd probably go with a custom plugin alternate tile provider. |
😂 Probably misunderstanding here, but does that ('custom plugin alternate tile provider') mean it can be done without submitting a PR for this library? |
Yes, I just create a map plugin, and don't use the default tile layer any
more (I find that too hard to follow these days anyway). For example...
https://github.com/ibrierley/flutter_map_vector_tiles/blob/master/lib/VectorTileWidget.dart
Eg line 81 & 99 defines the map plugin, and I basically loop over the tiles
needed around line 244, and grab the tiles around line 438, which could be
grabbing from a specific saved region of tiles for example. My stuff is too
messy, but it may give an outline of what I'm doing iyswim.
…On Tue, Aug 3, 2021 at 4:47 PM Luka S ***@***.***> wrote:
given the sluggish turnaround of changes here
😂
Probably misunderstanding here, but does that ('custom plugin alternate
tile provider') mean it can be done without submitting a PR for this
library?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#966 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5YN5NL7NWJ4HEN42JDQKTT3AFQHANCNFSM5ADBWIFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Just to add, the downside is you end up with some duplicated tile bits of
code you will see there (eg _isValidTile() method) ..there may be a way to
extend the tile layer using a plugin, but kind of got a bit lost with
trying that approach.
…On Tue, Aug 3, 2021 at 6:59 PM Ian B ***@***.***> wrote:
Yes, I just create a map plugin, and don't use the default tile layer any
more (I find that too hard to follow these days anyway). For example...
https://github.com/ibrierley/flutter_map_vector_tiles/blob/master/lib/VectorTileWidget.dart
Eg line 81 & 99 defines the map plugin, and I basically loop over the
tiles needed around line 244, and grab the tiles around line 438, which
could be grabbing from a specific saved region of tiles for example. My
stuff is too messy, but it may give an outline of what I'm doing iyswim.
On Tue, Aug 3, 2021 at 4:47 PM Luka S ***@***.***> wrote:
> given the sluggish turnaround of changes here
>
> 😂
>
> Probably misunderstanding here, but does that ('custom plugin alternate
> tile provider') mean it can be done without submitting a PR for this
> library?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#966 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA5YN5NL7NWJ4HEN42JDQKTT3AFQHANCNFSM5ADBWIFA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
> .
>
|
Sorry for the spam, in fact I'd almost be tempted to just make a pure
duplicate of the flutter_map tile layer as a map plugin (I don't think too
much needs changing to do that, if you look at my example of creating the
map plugin), edit as you need, may be simpler, and maybe others could use
it then as well. I know it would be 99% duplicated code, but it may allow
you/others to change as needed faster.
…On Tue, Aug 3, 2021 at 7:02 PM Ian B ***@***.***> wrote:
Just to add, the downside is you end up with some duplicated tile bits of
code you will see there (eg _isValidTile() method) ..there may be a way to
extend the tile layer using a plugin, but kind of got a bit lost with
trying that approach.
On Tue, Aug 3, 2021 at 6:59 PM Ian B ***@***.***> wrote:
> Yes, I just create a map plugin, and don't use the default tile layer any
> more (I find that too hard to follow these days anyway). For example...
>
>
> https://github.com/ibrierley/flutter_map_vector_tiles/blob/master/lib/VectorTileWidget.dart
>
> Eg line 81 & 99 defines the map plugin, and I basically loop over the
> tiles needed around line 244, and grab the tiles around line 438, which
> could be grabbing from a specific saved region of tiles for example. My
> stuff is too messy, but it may give an outline of what I'm doing iyswim.
>
>
>
> On Tue, Aug 3, 2021 at 4:47 PM Luka S ***@***.***> wrote:
>
>> given the sluggish turnaround of changes here
>>
>> 😂
>>
>> Probably misunderstanding here, but does that ('custom plugin alternate
>> tile provider') mean it can be done without submitting a PR for this
>> library?
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <#966 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AA5YN5NL7NWJ4HEN42JDQKTT3AFQHANCNFSM5ADBWIFA>
>> .
>> Triage notifications on the go with GitHub Mobile for iOS
>> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
>> or Android
>> <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
>> .
>>
>
|
Don't worry about the spam, I'm just as bad with editing my comments all the time :) I see. So I'm assuming thats using the Plugin API (plugins: [])? Thanks for the examples and suggestions! |
Yeah same, that naming is so confusing 😅 Don't worry, I just answered my own question looking at line 84 of your vector plugin. Thanks again, and I'll see what I can reasonably do with a tile layer (ie. As long as it doesn't triple the size of my library)! |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
For now I'm going to close this, even though I haven't yet done what @ibrierley suggested - I found it quite complicated. Thanks for the help! |
Discussed in #963
Originally posted by JaffaKetchup July 5, 2021
I need to do this as I'm implementing a way to remove grey tiles, but I can't change the base code in
flutter_map
. See JaffaKetchup/flutter_map_tile_caching#12.My existing code:
The text was updated successfully, but these errors were encountered: