4

I have a GeoTIFF file for which gdalsrsinfo reports this:

PROJ.4 : '+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs '

OGC WKT :
PROJCS["WGS 84 / UTM zone 32N",
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
    AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","32632"]]

If I try to import that file into Tilemill, I cannot view it properly. If I chose to let Tilemill autodetect the SRS, it fails:

Unable to determine SRS for layer "antani2" at /home/strappanai/antani2.tiff

If in Tilemill I specify a Custom PROJ.4 string instead, that is, the one I get from gdalsrsinfo (and from QGIS as well), that is

+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs

then the layer actually gets imported, but it is showed significantly tilted to the right - not as expected.

I don't know if this may matter to any extent, but QGIS imports and visualizes the file perfectly fine.

I also tried to reproject the source file as instructed here: https://www.mapbox.com/tilemill/docs/guides/reprojecting-geotiff/

But gdalwarp returns this error a thousand times and then fails:

ERROR 1: Too many points (441 out of 441) failed to transform,
unable to compute output bounds.
Warning 1: Unable to compute source region for output window     3593619,2225230,6394,6394, skipping.
More than 1000 errors or warnings have been reported. No more will be reported from now.

EDIT: This is the Layer Extent given by QGIS.

Layer Extent (layer original source projection) 638153.2011202700668946,5115644.8502587005496025 : 662908.4373886700486764,5132649.3878203006461263

Here's an identically behaving file: sample file

And here's how it's pictured in QGIS and in Tilemill (QGIS reads the SRS from the file, I specify the PROJ.4 string into Tilemill as stated above as it can't read it out from the TIFF).

enter image description here

10
  • Can you add the extent of the layer, as reported by QGIS with Rightclick on the layer, metadata tab?
    – AndreJ
    Commented Sep 28, 2015 at 13:26
  • It seems there is something unusual going on with your data. To give you an correct answer it would be great to get access to the data as they seem the act strange when you try to transform them. My first suggestion would be to copy the data using gdal_translate and define the output srs. Commented Sep 28, 2015 at 13:47
  • I added the layer extents as requested. I am afraid I cannod share the data being it unfortunately copyrighted, sorry. I also tried to gdal_transform the data but without success (maybe I did it the wrong way. Actually don't even remember how right now.
    – Dakatine
    Commented Sep 28, 2015 at 13:50
  • if i understand the error message correctly, gdalwarp finds GCPs within the image and tries to warp based on them. Somehow this seems not to work. Which reprojection method did you choose? gdalwarp says "The default is to select a polynomial order based on the number of GCPs". Maybe it would be better to use a different one. Commented Sep 28, 2015 at 13:55
  • 1
    Maybe I found your problem. On the Tilemill website it is stated "Since Mapnik is currently unable to reproject raster data sources, to load them in TileMill you must ensure they are in Web Mercator projection." Commented Sep 28, 2015 at 14:41

1 Answer 1

3
+100

I tested a bit with your example file. The solution was the following. I reprojected the file to WGS84 using QGIS and then added it to my Tilemill project defining the projection as WGS84.

The gdal command is as follows:

gdalwarp -overwrite -s_srs EPSG:32632 -t_srs EPSG:4326 -of GTiff antanired.tiff antanired_warp_WGS84.tiff

As you can see in the example it works with your provided data. But it failed leaving the settings on auto detect srs.

enter image description here

The tilting of the image to the right it only caused by srs differences. While the image is perfectly rectangular in UTM it will be a bit squeezed when it is shown in WGS84. The same will be true if you do it the other way around.

UPDATE

You might get rid of the black background by passing

nodata="0"

to the Advanced field during raster upload. As it is shown for Landsat data here

To give you the final answer to your question: The import is absolutely correct! Part of your error was the missing understanding of raster files and projections. I hope the trick with nodata definition works.

7
  • Thank you. Would you kindly be able to find a way to reproject it using any command line tool? I need to batch process plenty of data and using a GUI woulnd't be feasible. I try using gdalwarp: gdalwarp -s_srs EPSG:32632 -t_srs EPSG:3857 antanired.tiff antanired-3857.tiff With no success.
    – Dakatine
    Commented Sep 28, 2015 at 14:55
  • I also used gdalwarp, but only in QGIS. I will edit my answer and include it. Commented Sep 28, 2015 at 14:57
  • 1
    As tilemill is not longer developed why don't you change to mapbox studio. Maybe you could change the complete project to UTM there. Commented Sep 28, 2015 at 15:04
  • wait. I also got that result, but it shows black tilted borders around the area. That is not what I need. I need it to be shown horizontally just as in qgis, with no artifacts. Thanks.
    – Dakatine
    Commented Sep 28, 2015 at 15:04
  • 1
    As I said, horizontally will not be possible. It is now shown (correctly geolocated) in WGS 84. Horizontally is only possible if the tilemill project would be UTM. Commented Sep 28, 2015 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.