Opened 9 years ago
Closed 9 years ago
#5785 closed defect (fixed)
Shifted tiles with mbtiles
Reported by: | ottoxt | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.0 |
Component: | GDAL_Raster | Version: | 1.11.0 |
Severity: | major | Keywords: | mbtiles |
Cc: |
Description
After looking into the source code of gdal (http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/mbtiles/mbtilesdataset.cpp) I've decided my question of stackexchange suites better here:
I'm confused because of the representation of mbtiles files in QGIS. It seems that the whole grid is shifted by about 3 m to the south. So far I can observe this behavior only in the context of QGIS and mbtiles. What I did: Loaded Geotiff in Tilemill and exported as mbtiles. Loaded both files in QGIS. See result in attachment.
On the search for the cause I have
- generated the mbtiles file with geoscript-groovy: same result -> Tilemill does not seem to be the cause.
- taken an other GeoTIF -> same result: shifted 3m south.
- loaded the mbtiles-file in MapProxy, published it as WMS and loaded it in QGIS -> fits perfectly: the mbtiles file itself it seems so not to be the cause.
Attachments (1)
Change History (12)
by , 9 years ago
Attachment: | mbtilesshift.jpg added |
---|
follow-up: 2 comment:1 by , 9 years ago
Could you try the following patch ?
$ svn diff frmts/mbtiles/ Index: frmts/mbtiles/mbtilesdataset.cpp =================================================================== --- frmts/mbtiles/mbtilesdataset.cpp (révision 28173) +++ frmts/mbtiles/mbtilesdataset.cpp (copie de travail) @@ -1049,8 +1049,7 @@ /* GetGeoTransform() */ /************************************************************************/ -//#define MAX_GM 20037508.3427892 -#define MAX_GM 20037500. +#define MAX_GM 20037508.3427892 CPLErr MBTilesDataset::GetGeoTransform(double* padfGeoTransform) {
Are you sure the shift is 3m and not 8m ?
comment:2 by , 9 years ago
Replying to rouault:
I have nothing (no IDE) against which I can apply the patch, but what you did looks pretty good. If you want, I can upload files by which the deviation can be seen, so you can check it yourself.
Regarding 3m or 8m - its about 2.88m to be more exact. Is it possible that the deviation in the center is 0m and intensifies towards the edge ?
follow-up: 4 comment:3 by , 9 years ago
You could just edit frmts/mbtiles/mbtilesdataset.cpp with any text editor. The patch means removing the line with #define MAX_GM 20037500. and replacing it with #define MAX_GM 20037508.3427892. Anyway, the shift should be uniform. And you should likely also see a shift in eastings. So the issue might be something else...
follow-up: 5 comment:4 by , 9 years ago
I have such a file is not on my computer. Do you know where I can change anything on a computer with Win7 and OSGeo4W?
comment:5 by , 9 years ago
Replying to ottoxt:
I have such a file is not on my computer. Do you know where I can change anything on a computer with Win7 and OSGeo4W?
I assumed you built GDAL from source, but apparently not. Hum, no easy way to test the change then... and I'm a bit reluctant committing it without being sure it is appropriate.
comment:6 by , 9 years ago
Would it help if I put the mbtiles file from the attached jpg available (66m)? Or do you have a different suggestion?
comment:7 by , 9 years ago
The geotiff and the mbtiles could help. With such sizes, you can't use a ticket attachment and shoud use instead an external hosting solution, dropbox, etc...
comment:9 by , 9 years ago
comment:11 by , 9 years ago
Milestone: | → 2.0.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Taken from QGIS: Original TIF on top. Bottom with transparent mbtiles overlay.