CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.74k stars 3.45k forks source link

wrong image from wms at certain zoom levels #7994

Open idanmiara opened 5 years ago

idanmiara commented 5 years ago

Hi,

I'm trying to serve a COG (GeoTiff) through WMS via GeoServer and view it in Cesium (v1.59). It seems that for some maps, at certain zoom levels it shows some wrong tiles at some zoom level.

I've created a small (650KB) COG file (x[35.4,35.6]_y[31.6,31.8].cog.tif) to demonstrate the problem. There is no problem with the internal overviews as you can see via QGIS or OpenLayers.

Loading the file through QGIS as a file layer works fine. Serving the file as WMS via GeoServer and loading the layer via [QGIS or OpenLayers layer preview] also works fine.

Loading the layer via cesium demonstrates the problem. Steps to reproduce:

  1. Serve the raster layer via GeoServer [I used the latest geoserver-2.15.1 with CORS enabled, same I get the same results with many older versions]
  2. Load the layer via cesium using the attached script
  3. Zoom into the extent of the layer and zoom in and out around the north area of the lake (around 35.5,31.7) (It could be a bit hard to spot the raster on the glob as its extent is small)
  4. You will notice that some tiles are not in the correct places at a certain zoom level. zoom in/out and the problem disappears.

Browsers tested: Chrome Version 75.0.3770.100 (Official Build) (64-bit) on Windows 10 Firefox 67.0.4 (64-bit) on Windows 10

attached: 2 screenshots 1 cesium html file Cesium-wms-bug_html.zip 1 tif file. x[35.4,35.6]_y[31.6,31.8].cog.zip

Thanks, Idan.

Bug appears: screenshot-with-bug

Bug disappears after zooming: screenshot-without-bug

gdalinfo:

Size is 2330, 2330 Coordinate System is: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]] Origin = (35.399923324584961,31.800012588500977) Pixel Size = (0.000085830688477,-0.000085830688477) Metadata: AREA_OR_POINT=Area DESCRIPTION=Sentinel-2 cloudless - https://s2maps.eu by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 & 2017) IDENTIFIER=Sentinel-2 cloudless ZOOM_LEVEL=13 Image Structure Metadata: COMPRESSION=YCbCr JPEG INTERLEAVE=PIXEL SOURCE_COLOR_SPACE=YCbCr Corner Coordinates: Upper Left ( 35.3999233, 31.8000126) ( 35d23'59.72"E, 31d48' 0.05"N) Lower Left ( 35.3999233, 31.6000271) ( 35d23'59.72"E, 31d36' 0.10"N) Upper Right ( 35.5999088, 31.8000126) ( 35d35'59.67"E, 31d48' 0.05"N) Lower Right ( 35.5999088, 31.6000271) ( 35d35'59.67"E, 31d36' 0.10"N) Center ( 35.4999161, 31.7000198) ( 35d29'59.70"E, 31d42' 0.07"N) Band 1 Block=256x256 Type=Byte, ColorInterp=Red Overviews: 1165x1165, 583x583, 291x291, 146x146, 73x73, 36x36, 18x18, 9x9, 5x5, 2x2, 1x1, 1x1 Band 2 Block=256x256 Type=Byte, ColorInterp=Green Overviews: 1165x1165, 583x583, 291x291, 146x146, 73x73, 36x36, 18x18, 9x9, 5x5, 2x2, 1x1, 1x1 Band 3 Block=256x256 Type=Byte, ColorInterp=Blue Overviews: 1165x1165, 583x583, 291x291, 146x146, 73x73, 36x36, 18x18, 9x9, 5x5, 2x2, 1x1, 1x1

OmarShehata commented 5 years ago

Thanks for reporting this @imiara . Just to try and narrow this down, are you able to replicate this if the imagery is tiled or served by Cesium ion (https://cesium.com/ion/) ? Have you seen the same issue in CesiumJS 1.57, or 1.55?

idanmiara commented 5 years ago

Thanks for your response!

I could replicate the problem using CesiumJS 1.55, 1.57, 1.59 using the imagery served by Geoserver. I've tried tiled and untiled GeoTiffs, with and without internal overviews. 2D, 3D, Columbus modes. The problem remains the same regardless of any of these parameters.

I could NOT replicate the problem using the imagery served by Cesium ion using CesiumJS 1.59 or with the online Cesium.com viewer (using "Open complete code example")

In order to see the problem the fastest - use the magnifying glass to zoom into 35.55, 31.77, then zoom in and out.

On Tue, 23 Jul 2019 at 04:18, Omar Shehata notifications@github.com wrote:

Thanks for reporting this @imiara https://github.com/imiara . Just to try and narrow this down, are you able to replicate this if the imagery is tiled or served by Cesium ion (https://cesium.com/ion/) ? Have you seen the same issue in CesiumJS 1.57, or 1.55?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AnalyticalGraphicsInc/cesium/issues/7994?email_source=notifications&email_token=AGJBBLKXQ5K44WA2RFZ2Q6LQAZL6DA5CNFSM4ICF2OI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2RT4FA#issuecomment-514014740, or mute the thread https://github.com/notifications/unsubscribe-auth/AGJBBLMNMTEEPYA73ISXLELQAZL6DANCNFSM4ICF2OIQ .

md-seb commented 4 years ago

I have similar issue with weather tiles from our own WMS service. I think there is an issue with zoom level consistency. This is happening for me with Cesium master@23111a7c30 and v1.70

Zooming in on UK

viewer.camera.setView({destination: Cesium.Rectangle.fromDegrees(-5, 60, 5, 50)});

Causes these tiles to be requested:

tile X: 0 Y: 0 Level: 1. tile X: 0 Y: 1 Level: 1. tile X: 1 Y: 0 Level: 1. tile X: 1 Y: 1 Level: 1. tile X: 0 Y: 0 Level: 0. tile X: 2 Y: 0 Level: 2. tile X: 2 Y: 1 Level: 2. tile X: 1 Y: 0 Level: 2. tile X: 1 Y: 1 Level: 2. tile X: 8 Y: 3 Level: 4. tile X: 15 Y: 10 Level: 5. tile X: 16 Y: 10 Level: 5. tile X: 15 Y: 9 Level: 5. tile X: 16 Y: 8 Level: 5. tile X: 7 Y: 5 Level: 4. tile X: 7 Y: 4 Level: 4. tile X: 8 Y: 4 Level: 4. tile X: 16 Y: 9 Level: 5. tile X: 15 Y: 8 Level: 5. tile X: 8 Y: 5 Level: 4. tile X: 3 Y: 2 Level: 3. tile X: 31 Y: 21 Level: 6. tile X: 4 Y: 2 Level: 3. tile X: 31 Y: 22 Level: 6. tile X: 32 Y: 23 Level: 6. tile X: 32 Y: 21 Level: 6. tile X: 32 Y: 22 Level: 6. tile X: 15 Y: 11 Level: 5. tile X: 14 Y: 9 Level: 5. tile X: 16 Y: 11 Level: 5. tile X: 17 Y: 9 Level: 5. tile X: 31 Y: 23 Level: 6. tile X: 17 Y: 10 Level: 5. tile X: 14 Y: 10 Level: 5. tile X: 14 Y: 8 Level: 5. tile X: 17 Y: 8 Level: 5. tile X: 30 Y: 22 Level: 6. tile X: 30 Y: 21 Level: 6. tile X: 30 Y: 23 Level: 6. tile X: 33 Y: 22 Level: 6. tile X: 33 Y: 21 Level: 6. tile X: 33 Y: 23 Level: 6. tile X: 34 Y: 21 Level: 6. tile X: 34 Y: 22 Level: 6. tile X: 34 Y: 23 Level: 6. tile X: 17 Y: 11 Level: 5. tile X: 29 Y: 21 Level: 6. tile X: 29 Y: 22 Level: 6. tile X: 29 Y: 23 Level: 6. tile X: 28 Y: 21 Level: 6. tile X: 28 Y: 22 Level: 6. tile X: 14 Y: 11 Level: 5. tile X: 28 Y: 23 Level: 6. tile X: 35 Y: 21 Level: 6. tile X: 35 Y: 23 Level: 6. tile X: 35 Y: 22 Level: 6. tile X: 13 Y: 8 Level: 5. tile X: 13 Y: 9 Level: 5. tile X: 18 Y: 8 Level: 5. tile X: 18 Y: 10 Level: 5. tile X: 6 Y: 4 Level: 4. tile X: 13 Y: 10 Level: 5. tile X: 18 Y: 9 Level: 5. tile X: 27 Y: 21 Level: 6. tile X: 9 Y: 5 Level: 4. tile X: 27 Y: 22 Level: 6. tile X: 9 Y: 4 Level: 4. tile X: 6 Y: 5 Level: 4. tile X: 27 Y: 23 Level: 6. tile X: 36 Y: 21 Level: 6. tile X: 36 Y: 22 Level: 6. tile X: 13 Y: 11 Level: 5. tile X: 36 Y: 23 Level: 6. tile X: 6 Y: 3 Level: 4. tile X: 9 Y: 3 Level: 4. tile X: 18 Y: 11 Level: 5. tile X: 3 Y: 1 Level: 3. tile X: 4 Y: 1 Level: 3. tile X: 18 Y: 12 Level: 5. tile X: 13 Y: 12 Level: 5. tile X: 7 Y: 3 Level: 4. tile X: 3 Y: 0 Level: 3. tile X: 4 Y: 3 Level: 3. tile X: 4 Y: 0 Level: 3. tile X: 9 Y: 6 Level: 4. tile X: 3 Y: 3 Level: 3. tile X: 6 Y: 6 Level: 4.

idanmiara commented 4 years ago

I have found a workaround. I use Geoserver to serve the map. The default value for "Suggested Tile Size" in a new layer is 512,512. The block size of my tiff was 256x256 (use gdalinfo to find out the block size) It seems that when I changed the Suggested Tile Size to be 256,256 then the problem disappeared. note that with Tile size of 512,512 I see no problem when accessing the map via OpenLayers or QGIS. So I'm not sure if it's a bug in Geoserver that for some reason only appears when accessed via Cesium or it is a bug in Cesium.

On Tue, 23 Jun 2020 at 18:20, md-seb notifications@github.com wrote:

I have similar issue with weather tiles from our own WMS service. I think there is an issue with zoom level consistency. This is happening for me with Cesium master@23111a7c30 and v1.70

Zooming in on UK

viewer.camera.setView({destination: Cesium.Rectangle.fromDegrees(-5, 60, 5, 50)});

Causes these tiles to be requested:

tile X: 0 Y: 0 Level: 1. tile X: 0 Y: 1 Level: 1. tile X: 1 Y: 0 Level: 1. tile X: 1 Y: 1 Level: 1. tile X: 0 Y: 0 Level: 0. tile X: 2 Y: 0 Level: 2. tile X: 2 Y: 1 Level: 2. tile X: 1 Y: 0 Level: 2. tile X: 1 Y: 1 Level: 2. tile X: 8 Y: 3 Level: 4. tile X: 15 Y: 10 Level: 5. tile X: 16 Y: 10 Level: 5. tile X: 15 Y: 9 Level: 5. tile X: 16 Y: 8 Level: 5. tile X: 7 Y: 5 Level: 4. tile X: 7 Y: 4 Level: 4. tile X: 8 Y: 4 Level: 4. tile X: 16 Y: 9 Level: 5. tile X: 15 Y: 8 Level: 5. tile X: 8 Y: 5 Level: 4. tile X: 3 Y: 2 Level: 3. tile X: 31 Y: 21 Level: 6. tile X: 4 Y: 2 Level: 3. tile X: 31 Y: 22 Level: 6. tile X: 32 Y: 23 Level: 6. tile X: 32 Y: 21 Level: 6. tile X: 32 Y: 22 Level: 6. tile X: 15 Y: 11 Level: 5. tile X: 14 Y: 9 Level: 5. tile X: 16 Y: 11 Level: 5. tile X: 17 Y: 9 Level: 5. tile X: 31 Y: 23 Level: 6. tile X: 17 Y: 10 Level: 5. tile X: 14 Y: 10 Level: 5. tile X: 14 Y: 8 Level: 5. tile X: 17 Y: 8 Level: 5. tile X: 30 Y: 22 Level: 6. tile X: 30 Y: 21 Level: 6. tile X: 30 Y: 23 Level: 6. tile X: 33 Y: 22 Level: 6. tile X: 33 Y: 21 Level: 6. tile X: 33 Y: 23 Level: 6. tile X: 34 Y: 21 Level: 6. tile X: 34 Y: 22 Level: 6. tile X: 34 Y: 23 Level: 6. tile X: 17 Y: 11 Level: 5. tile X: 29 Y: 21 Level: 6. tile X: 29 Y: 22 Level: 6. tile X: 29 Y: 23 Level: 6. tile X: 28 Y: 21 Level: 6. tile X: 28 Y: 22 Level: 6. tile X: 14 Y: 11 Level: 5. tile X: 28 Y: 23 Level: 6. tile X: 35 Y: 21 Level: 6. tile X: 35 Y: 23 Level: 6. tile X: 35 Y: 22 Level: 6. tile X: 13 Y: 8 Level: 5. tile X: 13 Y: 9 Level: 5. tile X: 18 Y: 8 Level: 5. tile X: 18 Y: 10 Level: 5. tile X: 6 Y: 4 Level: 4. tile X: 13 Y: 10 Level: 5. tile X: 18 Y: 9 Level: 5. tile X: 27 Y: 21 Level: 6. tile X: 9 Y: 5 Level: 4. tile X: 27 Y: 22 Level: 6. tile X: 9 Y: 4 Level: 4. tile X: 6 Y: 5 Level: 4. tile X: 27 Y: 23 Level: 6. tile X: 36 Y: 21 Level: 6. tile X: 36 Y: 22 Level: 6. tile X: 13 Y: 11 Level: 5. tile X: 36 Y: 23 Level: 6. tile X: 6 Y: 3 Level: 4. tile X: 9 Y: 3 Level: 4. tile X: 18 Y: 11 Level: 5. tile X: 3 Y: 1 Level: 3. tile X: 4 Y: 1 Level: 3. tile X: 18 Y: 12 Level: 5. tile X: 13 Y: 12 Level: 5. tile X: 7 Y: 3 Level: 4. tile X: 3 Y: 0 Level: 3. tile X: 4 Y: 3 Level: 3. tile X: 4 Y: 0 Level: 3. tile X: 9 Y: 6 Level: 4. tile X: 3 Y: 3 Level: 3. tile X: 6 Y: 6 Level: 4.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CesiumGS/cesium/issues/7994#issuecomment-648232943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGJBBLLOGMEEJGVEQ7IITS3RYDB4FANCNFSM4ICF2OIQ .