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

Not all tiles are loading if i use Zoom Levels like 14.7 #605

Closed
eazy2x opened this issue Apr 27, 2020 · 22 comments
Closed

Not all tiles are loading if i use Zoom Levels like 14.7 #605

eazy2x opened this issue Apr 27, 2020 · 22 comments

Comments

@eazy2x
Copy link

eazy2x commented Apr 27, 2020

1st, forgive me if the problem is on my side, still new in programming/flutter.

I am trying to build a Map view, which whereever you are (Latitude - north/south) always displays the same distance (in meter) on the screen, with fixed zoom Level. Seeing that Zoom Level ist a double, i thought, cool no big deal, but now if i set it to 14.7 as an example this happens:

image

The tiles at the corners wont load until you move a bit closer to them in the map view, any way to trigger them loading a bit earlier or maybe fix that (if thats really an "issue")?

Oh and i use Mapbox, 'mapbox.dark', dont mind the Hexagons on top of the map they are markers.

@johnpryan
Copy link
Collaborator

This looks like a bug to me, do you have a lat/long and and size to reproduce the issue?

@ibrierley
Copy link
Collaborator

ibrierley commented Apr 28, 2020 via email

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

This happens anywhere, anytime (if you havent cached the map arround) but just with 14.7 zoom set (zoom, maxzoom and minzoom) i noticed it. Some decimals like 15.2 work fine, seems only the last bit until you reach the next Level? This example anyway is at LatLng(64.137125, -21.902071); (iceland)

Might also be different depending on phone screen size/ratio? I am using Nexus 6 api 28 for the emulator.

@ibrierley
Copy link
Collaborator

ibrierley commented Apr 28, 2020 via email

@eazy2x eazy2x closed this as completed Apr 28, 2020
@eazy2x eazy2x reopened this Apr 28, 2020
@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

sorry accidently closed

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

i tested 0.8.2 now (changed yaml file/pub get) which should revert that (and other stuff) but same issue, using 14.7 zoom wont load tiles if they are at the edges of the screen.

@ibrierley
Copy link
Collaborator

any way for you to have a minimal example that breaks it that people could try ?

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

Basicly used the "on_tap" page in examples, using that and set all zoom levels to 14.7 should do the trick. And i removed AppBar, even hide status bar, not sure if that has an effect (but even sides left/rigth wont load if it's just a bit in the screen)

@ibrierley
Copy link
Collaborator

ibrierley commented Apr 28, 2020 via email

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

did some testings:

it is worst at 14.5 getting better slowly until 15 is fine. Then 15.0 - 15.49 has no problem at all (same as 14.0 - 14.49 has no issue)

so just the .5 to .99 range is causing the problem

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

Have you tried 0.9.0 ?

sure, before i used "any" so should have been, going back to 0.8.2 was my quick way to test the package before your pull (checked dates) as i have no clue how to change it manually.

@ibrierley
Copy link
Collaborator

ibrierley commented Apr 28, 2020 via email

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

oh and i think it depends on the latitude you are on, swapped to Singapore (near 0) and at 14.5 i have barely an issue (just a tiny bit), so issue seems to come with the stretch factor of the map, going nort/south

the very problem i am working on right now (to show fixed size window with same meters)
working formulas i foud here:
https://gis.stackexchange.com/questions/110730/mercator-scale-factor-is-changed-along-the-meridians-as-a-function-of-latitude

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

Really just use the on_tap just added my hexagon "markers" as i have to learn it by starting with something that works.

My quick test start points: (and as said using mapbox.dark)

// static LatLng startPoint = LatLng(71.167802, 25.782208); //Nordkap
// static LatLng startPoint = LatLng(64.137125, -21.902071); // Island
// static LatLng startPoint = LatLng(34.031037, -5.002876); // Marokko
static LatLng startPoint = LatLng( 1.329646, 103.840275); // Singapur

center: startPoint,
zoom: fixedZoom,
maxZoom: fixedZoom,
minZoom: fixedZoom,

and fixed zoom i just set by hand to test some samples, now i want to compute it, using the formulas in that stack link and break it down to mapzoom using log2

so at Singapore, barely an issue, but up north and biggest problem at .5 levels, no issue at .0-.49

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

to compare: singapore at 14.5 lvl (thats the worst i can get it to by slowly moving map)
image

vs cape north, again worst case by slowly moving map

image

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

from math aspect, i guess the error is no counting in the stretch of the map projection, to dig/dive into the code of package i am not able at this point, even struggle to understand basic stuff, but hope my observations may help you guys, probably not many testing uneven zoom levels up north lol

@ibrierley
Copy link
Collaborator

ibrierley commented Apr 28, 2020 via email

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

i will try to put an example together, tried OSM now as provider, tiles are smaller compared to mapbox, issue still there but not that obvious as the width of possible missing tiles area is cut by / 2

@eazy2x
Copy link
Author

eazy2x commented Apr 28, 2020

Now i am confused, trying to rebuild, all works fine, removed paddings, column/flex/deleted app bar, also hide status bar, all works in this sample app as usual.

Last difference i can spot: i also did remove that "drawer: ..." as i only use 1 screen (but i dont really know what this is doing) could it be the issue? sorry for wasting your time :/

could send you my //spaghetti// code i am not to proud of

@maRci002
Copy link
Contributor

maRci002 commented Apr 28, 2020

Unreproducible, tested with this code:

class OnTapPage extends StatelessWidget {
  static const String route = 'on_tap';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(title: Text('OnTap')),
      drawer: buildDrawer(context, OnTapPage.route),
      body: FlutterMap(
        options: MapOptions(
          center: LatLng(51.5, -0.09),
          zoom: 14.7,
          maxZoom: 15.0,
          minZoom: 3.0,
          onTap: print,
        ),
        layers: [
          TileLayerOptions(
            urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            subdomains: ['a', 'b', 'c'],
          ),
        ],
      ),
    );
  }
}

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label Mar 28, 2021
@github-actions
Copy link

github-actions bot commented Apr 2, 2021

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants