-
-
Notifications
You must be signed in to change notification settings - Fork 868
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
[BUG] TMS support seems to be partially broken #1394
Comments
What happens if you try -y and not y in your template url.. ? |
In this way, an error will be reported directly, and the layer resource cannot be requested |
I see that the web side uses the proj4 and proj4leaflet.js plug-ins to call this layer. I don't know the flutter_ Does the map support proj4leaflet.js |
Hmm, maybe this is an issue in proj4dart then? Have no idea, but there is not JavaScript dependency here! |
I think our
https://wiki.openstreetmap.org/wiki/TMS
Right now, from what I can see, we don't take this into account when we build the tile URL from the template. On the other hand, if Baidu is using TMS tiles, there seems to be some sort of inversion of Would be prettier to handle this in the URL template though, since that seems to be the way others do it. |
Typically all things being equal I think it makes sense to match up with what Leaflet.js does as much as possible. |
Fair enough, they seem to be using the @gpsim if you can clean up your example so it's easier to use it, it would also be easier for us to test. The formatting is all over the place and it looks like it contains some dead code as well. |
(have tidied it up a bit, see if that helps) |
The definition of int invertY(int y, int z) {
return ((1 << z) - 1) - y;
} ... or maybe this is not the intended purpose. With int invertY(int y, int z) {
return -y;
} ... the code seems to work. |
It seems Leaflet does support The confusing This has since been fixed, to: EDIT: It also seems like we are unconditionally requesting retina/large tiles when |
I tinkered a bit trying to align our code with Leaflet's but the tile layer code is so hairy... might be better to address this as part of a larger refactor. This is as far as I got without making larger modifications. See my comments inline. String _getTileUrl(String urlTemplate, Coords coords, TileLayer options) {
final z = _getZoomForUrl(coords, options);
// No easy access to _pxBoundsToTileRange in TileLayerState, also no access to projected tile bounds.
// Needless to call this for every tile if we have a globalTileRage which is always up-to-date
// ... but important to keep it up-to-date: https://github.com/ghybs/Leaflet.TileLayer.Fallback/pull/14
final globalTileRange = _pxBoundsToTileRange(options.tileSize, bounds);
final invertedY = '${(globalTileRange.max.y - coords.y).round()}';
final opts = <String, String>{
'x': '${coords.x.round()}',
// No check for !crs.infinite
'y': options.tms ? invertedY : '${coords.y.round()}',
// No check for !crs.infinite
'-y': invertedY,
'z': '${z.round()}',
's': getSubdomain(coords, options),
// Added retinaMode check
'r': options.retinaMode ? '@2x' : '',
}..addAll(options.additionalOptions);
return options.templateFunction(urlTemplate, opts);
}
// Duplicated code from TileLayerState
Bounds _pxBoundsToTileRange(num tileSizePx, Bounds bounds) {
final tileSize = CustomPoint(tileSizePx, tileSizePx);
return Bounds(
bounds.min.unscaleBy(tileSize).floor(),
bounds.max.unscaleBy(tileSize).ceil() - const CustomPoint(1, 1),
);
} |
Yeah @JosefWN, we've come to a similar conclusion internally. There's so many features to add, fix and remove from |
It's kind of difficult to visualise a rewrite of the tile layer I think without something a bit more concrete. I'm not sure what the specific aims and criteria would be. Maybe it needs to be part of a separate discussion about what's needed and how it would be interfaced to (especially with the notion of when we have multiple tile layers). I certainly can understand the issues around access, as I've had similar myself and done my own version in the past here, so more than happy to ponder somewhere. |
Yeah, I think several aspects need to change. In general: less is more, there are some features I doubt anyone is using (like controlling where fade-in animations start/stop). Everything comes with a cost, if not in performance then in maintenance. I think a sane way of looking at things in the long run is not "Is this a nice to have?" but rather "Is this something more people than the author of the PR will actually benefit from?". Forking is not that hard anyway, if you have really exotic needs. Then there is the architectural issues; the current solution feels both complex and rigid. I can just intuitively tell that "something is not right" when I'm working with that piece of code, but I haven't thought further in terms of how to make it so. |
Should we be making a Project to track things that might be added to a larger refactor/rewrite? Unfortunatley we can't add a project to the new Projects version on GitHub (lack of permissions), but we can create a 'classic' Project. |
(We might want to do something similar to group issues about MacOS gestures (similar to something like #1395)) |
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. |
I think this could be relabelled a bug, with TMS support being at least partially broken in |
The only (good) way to re-add TMS support is to get a |
What do you want implemented?
Hello, I tried to achieve Baidu layer tiles, but always render out of order.
http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1
What other alternatives are available?
I tried to modify the proj4 property with the following code.
Can you provide any other information?
Platforms Affected
Android, iOS
Severity
Obtrusive: No workarounds are available, and this is essential to me
Requirements
The text was updated successfully, but these errors were encountered: