Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6114 closed defect (duplicate)

Error when using spatial reference EPSG:3440 in gdal2tiles.py

Reported by: alqurri Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Hi;

I was using gdal2tiles.py with spatial reference WSG84 and it was working fine. However, when I changed to spatial reference EPSG:3440, as folllows:

First, I run the command:

gdal_translate -of VRT -a_srs EPSG:3440 -gcp 0 0 58.068451479718924 23.65512391903488 -gcp 21816 0 58.126966134442846 23.65512391903488 -gcp 21816 14871 58.126966134442846 23.6185834507829  myinputimage.png myoutput.vrt

Than, I run the command:

python gdal2tiles.py  myoutput.vrt

I got the following error:

Generating Base Tiles:
ERROR 5: Illegal values for buffer size
ERROR 5: Illegal values for buffer size
Traceback (most recent call last):

Now, I did some search and I found this link where it mention that this error happen due to empty tiles:

https://trac.osgeo.org/gdal/ticket/6057

So I went ahead and implemented this changes that is proposed on this link to gdal2tiles.py. After that, I notice the error have disappeared, however, all the generated tiles are empty. Hence, I think there is a problem when gdal encounter some projection such as EPSG:3440

Thanks!

Attachments (1)

vDpwF.png (14.3 KB ) - added by alqurri 9 years ago.
Output of gdal2tiles.py before applying changes

Download all attachments as: .zip

Change History (3)

by alqurri, 9 years ago

Attachment: vDpwF.png added

Output of gdal2tiles.py before applying changes

comment:1 by Even Rouault, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #6057

comment:2 by Jukka Rahkonen, 9 years ago

It seems to me that there is also wrong usage of gdal_translate which is based on a belief that -a_srs would make warping.

With EPSG:3440 http://epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::3440 the GCP values in the command are probably nonsense

-gcp 0 0 58.068451479718924 23.65512391903488 -gcp 21816 0 58.126966134442846 23.65512391903488 -gcp 21816 14871 58.126966134442846 23.6185834507829

I believe that the image is bigger than just a few centimeters and I guess that the values are actually EPSG:4326 lon-lat degrees. You must not just assign EPSG:3440 and still continue to insert GCPs which are in EPSG:4326. The right thing to do is:

  • attach the GCPs with values in EPSG:4326
  • gdalwarp -s_srs epsg:4326 -t_srs EPSG:3440

OR

  • reproject the GCP values to EPSG:3440 and attach them
  • gdalwarp -s_srs epsg:3440 -t_srs EPSG:3440

Bug may be real, image which covers an area of 6x6 cm is valid in GIS.

Nest time I suggest to write first a mail into gdal-dev mailing list.

Note: See TracTickets for help on using tickets.