1

I'm currently looking at re-projecting a tiff file I have of population density. The file is using The Mollweide Projection.

I have come to understand that Gdal would allow me to do this. I have downloaded the software and have been through a few really good basic tutorials Robert Simmon blog.

I am now trying to apply the same steps to the file I have. I've typed the following command: gdalwarp -t_srs EPSG:3395 -r lanczos -wo SOURCE_EXTRA=1000 -co COMPRESS=LZW F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped.tif F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped_Mercator.tif

The cmd window just displays a 0, I've let it run for a couple of hours as I thought it might be a problem of file size. I was thinking that it just meant that the software was processing the file. The original file is 340mb.

I've got a feeling that my gdalwarp command might be wrong or the file size is too big. With my little knowledge of python or gdal the solution is eluding me.

Original File gdalinfo:

C:\Users\ttomt>gdalinfo F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped.tif
Driver: GTiff/GeoTIFF
Files: F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped.tif
Size is 141988, 60942
Coordinate System is:
PROJCS["World_Mollweide",
    GEOGCS["GCS_WGS_1984",
        DATUM["D_WGS_1984",
            SPHEROID["WGS_1984",6378137.0,298.257223563]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Mollweide"],
    PARAMETER["False_Easting",0.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",0.0],
    UNIT["Meter",1.0]]
Origin = (-17619594.547443531000000,8750529.461868489200000)
Pixel Size = (250.000000000000000,-250.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-17619594.547, 8750529.462) (  4d35'30.71"W, 83d37'50.88"N)
Lower Left  (-17619594.547,-6484970.538) (107d 3'58.73"E, 55d59' 2.97"S)
Upper Right (17877405.453, 8750529.462) ( 15d11'38.88"E, 83d37'50.88"N)
Lower Right (17877405.453,-6484970.538) (103d21'55.35"W, 55d59' 2.97"S)
Center      (  128905.453, 1132779.462) (  1d17'47.23"E,  9d10'35.76"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
  • Run gdalinfo for the source image and add the report to your question. – user30184 Apr 22 '18 at 18:51
  • When I try reducing the sizeit gives me this comment: C:\Users\ttomt>gdal_translate -r lanczos -tr 0.1 0.1 -co COMPRESS=LZW F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped.tif F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped_reduced.tif Input file size is 141988, 60942 0ERROR 1: GTiffCreateCopy():No space for strip arrays ERROR 1: MissingRequired:TIFF directory is missing required "StripOffsets" field ERROR 1: MissingRequired:TIFF directory is missing required "StripOffsets" field – Tom Apr 22 '18 at 19:31
  • It could help to create a tiled tiff as output -co TILED=YES. If that does not help try to create an uncompressed output and compress it later. – user30184 Apr 22 '18 at 19:39
  • Thanks for helping me @user30184. I tried the tiled commend. It is attempting to create even larger files. C:\Users\ttomt>gdal_translate -r lanczos -tr 0.1 0.1 -co TILED=YES F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped.tif F:\ArcGis\Gdal\NE1_50M_SR_W\DensityMaps\Pop1Warpped_reduced.tif Input file size is 141988, 60942 0ERROR 3: Free disk space available is 271025307648 bytes, whereas 216325817400000000 are at least necessary. You can disable this check by defining the CHECK_DISK_FREE_SPACE configuration option to FALSE. – Tom Apr 23 '18 at 7:14
  • Can you point to some test data? – user30184 Apr 23 '18 at 7:16
1

It seems that the lanczos resampling makes the process to jam. Use other resampling methods, starting from nearest that is the fastest and see if the result is good enough for you. This command should run in about half an hour.

gdalwarp -t_srs EPSG:3395 -r nearest -wo SOURCE_EXTRA=1000 -co TILED=YES -co COMPRESS=LZW -co PREDICTOR=2 input.tif output.tif

If you want to look the result with a GIS client like QGIS you should also create overviews with gdaladdo http://www.gdal.org/gdaladdo.html for making the browsing faster. It is better to write external overviews with the -ro option because adding LZW compressed overviews into existing large image is very slow.

gdaladdo -ro output.tif 2 4 8 16 32 64 --config COMPRESS_OVERVIEW LZW

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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