Skip to content
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

gdalretile.py having problems with tiling #670

Closed
jussilaville opened this issue Jun 6, 2018 · 9 comments
Closed

gdalretile.py having problems with tiling #670

jussilaville opened this issue Jun 6, 2018 · 9 comments
Assignees
Labels
Milestone

Comments

@jussilaville
Copy link

I upgraded Python version from 3.3.6 to 3.6.5 and GDAL version from 1.11.1 to 2.2.4 on my Windows 10 laptop (same actually happens with Windows Server 2012 with same Python and GDAL configuration). I’m using gdal_retile.py script for retiling Our rasterized Base map files for Geoserver ImagePyramid plugin. Unfortunately now it seems that this script makes grey pixel row at the end of the file. This did not happen in earlier configuration I had.

Below you find a screen shot from level 1, where the grey row is at the bottom of the image.
level1

Below you find a screen shot from level 2, where the grey line runs through the image horizontally
level2

Here is the command I’m running
gdal_retile -v -r bilinear -levels 4 -ps 2048 2048 -co "TILED=YES" -co "BLOCKXSIZE=256" -co "BLOCKYSIZE=256" -co "COMPRESS=LZW" -targetDir D:\TEMP\Imagepyramid D:\TEMP\test1.tif

I tried to change the resampling algorithm or leaving out the Blocksize or Compress parameters without any success. I tried the older versions we are using and the grey pixel row did not appear in the picture.

Here is the sample picture to reprodeuce the problem, unfortunately I had to convert TIF to JPG.
test1

@jratike80
Copy link
Collaborator

The map is "kantakartta" of the City of Helsinki, isn't it? Do you have a link for downloading a sample?

@jussilaville
Copy link
Author

Hi,

That's true. I think you can download a sample from our Open data Geoserver. Here is the URL for that specific map tile.

https://kartta.hel.fi/ws/geoserver/avoindata/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES&LAYERS=avoindata:Kantakartta_harmaa&SRS=EPSG:3879&WIDTH=3000&HEIGHT=3000&BBOX=6670000,25498000,6671000,25499000&FORMAT=image/geotiff

Reduce the WIDTH and HEIGHT parameter if the file is too large. That is maximum our Geoserver can render.

@jratike80
Copy link
Collaborator

Have you tried to use the same gdal_retile.py that gives good result with the new GDAL version?

@jussilaville
Copy link
Author

Tried the old version of gdal_retile.py and the grey row did not appear.

Not sure but this must be some kind of version Id from the file
"$Id: gdal_retile.py 27044 2014-03-16 23:41:27Z rouault $"

gdal_retile.zip

@rouault
Copy link
Member

rouault commented Jun 8, 2018

I've downloaded the source image from the WMS link you provided and run the gdal_retile command you mentionned, and can't observe any artifact. I've also run it with the old version of gdal_retile you provide above, and the generated files are binary identical with the old and new gdal_retile.

@rouault rouault added the awaiting_feedback Awaiting feedback from reporter label Jun 8, 2018
@jussilaville
Copy link
Author

My mistake. Sorry for that.

The original picture I'm using was 5000x5000 pixels width and height. Running the command I posted fo the 3000x3000 picture the 1 level is not retiled.

If you run command below for the downloaded raster file

gdal_retile -v -r bilinear -levels 4 -ps 1024 1024 -co "TILED=YES" -co "BLOCKXSIZE=256" -co "BLOCKYSIZE=256" -co "COMPRESS=LZW" -targetDir D:\TEMP\Imagepyramid D:\TEMP\test1.tif

You should see the grey line in level 1 picture 1_1.tif. Or otherwise I'm doing something really wrong.

I also uploaded 5000*5000 picture to our "dropbox". Press "Lataa" to download the zip-file

https://kympbox.kkip.fi/kympboxd/download.aspx?hash=L4AN0Y3HCQPNFO7YWVVEIE8MJ2KY7XHJXRA1UJ2A

@jratike80
Copy link
Collaborator

I made a test with OSGeo4W (GDAL 2.2.4, released 2018/03/19) with the 5000x5000 image. I can see grey lines in tiles which are in sub-directories 2, 3, and 4 and created with your command.

I do not quite understand what happens, but this command does not produce grey lines

gdal_retile -v -r bilinear -levels 4 -ps 1024 1024  -co "C
OMPRESS=LZW" -overlap 5 -pyramidOnly -targetDir c:\TEMP\poista\retile\Imagepyram
id test1.tif

@jratike80
Copy link
Collaborator

jratike80 commented Jun 18, 2018

It seems that revision 28001 is the first one that makes grey lines. Changeset is "a patch by pabercrombie" committed by Even
https://trac.osgeo.org/gdal/changeset/28001/trunk/gdal/swig/python/scripts/gdal_retile.py
referring ticket https://trac.osgeo.org/gdal/ticket/5749.

I tried to read the code but unfortunately could not discover what goes wrong with computing the windows with the new code.

@rouault rouault added bug and removed awaiting_feedback Awaiting feedback from reporter labels Jun 18, 2018
@rouault rouault added this to the 2.3.1 milestone Jun 18, 2018
@rouault rouault self-assigned this Jun 18, 2018
@rouault
Copy link
Member

rouault commented Jun 18, 2018

Thanks Jukka for bisecting to the offending commit. That was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants