osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.67k stars 1.02k forks source link

MapTileDownloader: Empty tiles from WMS-servers due to excessive stretching #16154

Open Gabriel85 opened 1 year ago

Gabriel85 commented 1 year ago

Description

There is a problem with the aspect ratio of the {bbox}-variable. They are not square (in EPSG-4326) which can lead to problems with WMS servers using raster maps. Probably due to excessive stretching (by a factor of 1.49 in the example below), it can create an empty tile. Many WMS servers enforce a maximum stretching factor (e.g. 1.2).

Possible fix: an additional EPSG-3857 {bbox}, based on TMS (like https://github.com/timwaters/whoots/blob/master/whoots_app.rb). Those should be always square and won't require stretching.

How to reproduce?

For example this is an request generated by the app which returns an empty tile: https://sgx.geodatenzentrum.de/wms_dtk_bkg?FORMAT=image/png&LAYERS=DTK500&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:4326&BBOX=8.43750000,47.87214397,8.61328125,47.98992167&WIDTH=256&HEIGHT=256

If I change the link so the latitude and longitude have the same distances, it works again: https://sgx.geodatenzentrum.de/wms_dtk_bkg?FORMAT=image/png&LAYERS=DTK500&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:4326&BBOX=8.43750000,47.87214397,8.61328125,48.04792522&WIDTH=256&HEIGHT=256

The same is true if I reduce the pixel height of the tile a bit: https://sgx.geodatenzentrum.de/wms_dtk_bkg?FORMAT=image/png&LAYERS=DTK500&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:4326&BBOX=8.43750000,47.87214397,8.61328125,47.98992167&WIDTH=256&HEIGHT=247

Your Environment

OsmAnd Version: 4.3.5 Android/iOS version: Android 11 Device model: Oneplus 7 Pro

Maps used (online or offline):
https://sgx.geodatenzentrum.de/wms_dtk_bkg?FORMAT=image/png&LAYERS=DTK500&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:4326&BBOX={bbox}&WIDTH=256&HEIGHT=256

Zirochkabila commented 1 year ago

OsmAnd~ 4.4.0#14164mqta, Released: 2023-02-09 Reproduced Rendering version doesn't matter logcat (56).log

S - 1 reprodused tile S1 - 2nd S3 - 3th

https://user-images.githubusercontent.com/104760013/218269480-e39228a0-81e8-4b6d-9015-c38152e86fce.mp4