0

I've generated a tileindex (.shp file) of some COG files using gdaltindex. However, when loading the shapefile through MapServer in Leaflet, some of the tiles seem to go blank partially when zooming in. The below video illustrates the problem:

Video: https://youtu.be/PwhFI4pXiMQ

The blue lines (which is a separate layer for debugging) represent the edges of the COG files. When zooming in, part of the tiles seem to turn white, right at the edge.

Looking at the data with another debug GridLayer (red), I observed the following:

enter image description here

This specific tile (red square) seems to load the top right part of the bottom left COG file. It also loads the top left part of the bottom right COG file. However, it does not seem to load (white) the bottom parts of the two top COG files.

Could this be an overlapping issue?

Additionally, I've loaded the separate COG files in QGIS, which worked fine even when zooming in further. This to me sounds like it's not necessarily an issue with the COG files themselves. Another issue might be the on the fly reprojection from EPSG:28992 (cog files) to EPSG:4326 (for leaflet), but this is all very new to me.

Can someone point me in a direction I might need to look in or what other info I need to provide to properly debug this?


Looking at the debug log for the specific tile pictured above, you can observe it only loads the two bottom tiles and does not mention any of the two tiles above the blue line. Overlap seems to be less of an issue, so maybe it's the tileindex.

GDAL: GDALOpen(/vsis3/aerial-imagery-2021-nl/TrueOrtho_02_36.tif, this=0x4000b81440) succeeds as GTiff.
GTiff: ScanDirectories()
GTiff: Opened 62500x43750 overview.
GTiff: Opened 31250x21875 overview.
GTiff: Opened 15625x10938 overview.
GTiff: Opened 7813x5469 overview.
S3: Downloading 45629958-45633633 (<redacted>/TrueOrtho_02_36.tif)...
S3: Downloading 46608354-46613377 (<redacted>/TrueOrtho_02_36.tif)...
S3: Download completed
GDAL: GDALClose(/vsis3/aerial-imagery-2021-nl/TrueOrtho_02_36.tif, this=0x4000b81440)
GDAL: GDALOpen(/vsis3/aerial-imagery-2021-nl/TrueOrtho_03_36.tif, this=0x4000a4c8d0) succeeds as GTiff.
GTiff: ScanDirectories()
GTiff: Opened 62500x28125 overview.
GTiff: Opened 31250x14063 overview.
GTiff: Opened 15625x7032 overview.
GTiff: Opened 7813x3516 overview.
S3: Downloading 26882248-26885823 (<redacted>/TrueOrtho_03_36.tif)...
S3: Downloading 27737372-27741769 (<redacted>/TrueOrtho_03_36.tif)...
S3: Download completed
GDAL: GDALClose(/vsis3/aerial-imagery-2021-nl/TrueOrtho_03_36.tif, this=0x4000a4c8d0)
[warn] [pid 348] mod_fcgid: stderr: CGI Request 409 on process 104
[warn] [pid 348] mod_fcgid: stderr: msDrawMap(): kicking into non-square pixel preserving mode.
[warn] [pid 348] mod_fcgid: stderr: msDrawMap(): rendering using outputformat named jpeg (AGG/JPEG).
637941 - 172.19.0.1 - - [19/Jul/2022:14:10:11 +0000] "GET /wms?service=WMS&request=GetMap&layers=NL2021&styles=&format=image%2Fjpeg&transparent=false&version=1.1.1&width=256&height=256&srs=EPSG%3A4326&bbox=3.5939025878906254,51.30486238965096,3.5952758789062504,51.30572093078555 HTTP/1.1" 200 4865 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"

Changing the output format to PNG as suggested by @ivansanchez at least makes the parts that are not fetched 'transparent'. Now it's clear some cog files are not loaded through the tileindex, as supported by the log file above (for the first image).

enter image description here

6
  • Do I understand correctly nearblack should be run over the cog files? I've put four adjacent cog files by themselves in qgis and the don't seem to have this overlapping issue. Which to me looks like it's an issue in mapserver? Jul 19 at 12:53
  • So you're loading the COG through a mapserver WMS, I guess? If that's the case, remember that the transparent parameter must be explicitly added to the request. Jul 19 at 13:13
  • Correct. Transparent parameter is by default set by leaflet to false, however if I change it to true the white turns black. Jul 19 at 13:36
  • Remember that image/png format can do transparent pixels, and image/jpg cannot. Jul 19 at 14:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.