Open arneke opened 1 week ago
( @monsieurtanuki )
I don't think the code currently handles cases where
- the grid is not square
- has more than one tile for z = 0
- or the projection does not cover the world
@arneke Indeed, what I know about GIS is limited to
power(2, zoom)
x and y coordinates (therefore 1*1 tile for zoom = 0)Which of my assumptions is wrong in your case? With your help, I'd be able to make both systems work - webmercator and more exotic ones. Possibly with a flag.
I'll have a look at your example and see what happens.
Thanks for responding 👍
Unfortunately it gets a bit more complicated. Resolutions where you divide by two are common, but there are also grids where each matrix corresponds to 1:1000, 1:2000, 1:2500 , etc, to match old requirements.
And to be fair, there is quite a bit of code in flutter_map that makes this confusing. (The projection has to be the same for all layers, but each layer should actually have a separate set of resolutions and origins, so that tile boundaries from different sources do not have to align perfectly)
You can have a look at https://www.trafikverket.se/trafikinformation/vag/ , the web client illustrates that you cannot zoom out to a single tile, z = 0 is actually 6 x 10 tiles (approximately).
The tilematrix is described in And https://maps.trafikinfo.trafikverket.se/MapService/wmts.axd/BakgrundskartaNorden.gpkg?Service=WMTS&Request=getcapabilities
To be honest, I think you should only do this for webmercator, revert to the old behavior for all others. Will cover 90% of the use cases and not break anything.
@arneke Looking back at the code, hopefully it won't be hard to fix (?) because I only added a couple of new classes. Those classes make sense anyway, it's just that in "your" case they have a slightly different behavior - e.g. "no it makes no sense to add power(2, zoom) to an X coordinate".
@arneke Good news - in a first approach - I've managed to roll back my changes in only 5 files. | before | after |
---|---|---|
That doesn't mean that the implementation for both systems is done yet ;)
nice 👏
@arneke I think I'll PR tomorrow.
@arneke I'm about to PR. Would that be OK for me to include your ESPG:3006 code snippet as an example, so we can check from version to version if everything is alright? Actually, any "no -180+180" projection would be good as far as I'm concerned, but I'm not able to invent one.
No, as written in the comment, that one is a bit encumbered, would not make it "official".
https://demo.fleaflet.dev/crs_epsg4326
appears to be broken on master, but it's not a very general case.
I can look tonight for a better example
I can look tonight for a better example
Thank you, that would be perfect: just find the easiest / most stupid example you can, that doesn't work with the master but works with 7.0.2.
I have updated the example above with one I believe is ok to add to the repo. Comment above, origin and urlTemplate have been replaced.
If you make the branch you are working on public somewhere, I'd be happy to test it. (Waiting for this issue to be resolved before I can deploy a new version of my own app.)
Waiting for this issue to be resolved before I can deploy a new version of my own app.
Oh, I wasn't aware of that. First test with new example looks ok. I'll try to PR this morning.
@arneke cf. #1978
What is the bug?
My EPSG:3006 WMTS layer works in 7.0.2, but stopped working after I switched to the master branch. On closer inspection, the reason was that flutter_map is requesting the wrong x,y,z tiles for a given lat,long position.
I've not completely isolated #1948 as the cause, but I think it's the most likely thing in the commit log, and there is an assumption about the modulus that is not generally true.
How can we reproduce it?
Most non-WebMercator grids should trigger this, but here is one.
Do you have a potential solution?
I don't uderstand all the code in #1948 , but I believe the problem originates in
final modulo = 1 << coordinates.z;
https://github.com/fleaflet/flutter_map/blob/d73d2f1a230957b79a12f82d96de420b68715006/lib/src/layer/tile_layer/tile_coordinates.dart#L28
I don't think the code currently handles cases where
In general, I think you need a flag on the CRS to know whether unbounded scroll applies. Or only enable it for WebMercator for now.
Platforms
All
Severity
Obtrusive: Prevents normal functioning but causes no errors in the console