0

I am making geoTIFs of weather data (for a Mapbox overlay) and I am converting them to web mercator for use on the map. The images were generated from the same source file and both images have the same coordinates (files provided below). The first file below converts to Web Mercator perfectly and shows up in Mapbox exactly where it should be. The second file (according to the gdalinfo dump) converted to Web Mercator also - but the coordinates changed! Why is this and how do I fix it? The second file does not display properly on the map because of this.

Below are links to both geoTIF files and my script I used to convert.

KEWX_L2_REF.TIF - 1st original geoTIF file, it converts just fine

KEWX_L2_VEL.TIF This is the 2nd original geoTIF file, the one that won't convert without distorting coordinates

Here are the GDALINFO dumps :

KEWX_L2_REF.tif - Original KEWX_L2_REF-projected.tif Projected (coordinates are good after conversion)

KEWX_L2_VEL.tif - Original KEWX_L2_VEL-projected.tif - Projected (coordinates have changed for some reason, should match the REF file above

The scripts I am using for these are the following :

gdalwarp EPSG:3857 KEWX_L2_REF.tif KEWX_L2_REF-projected.tif

and

gdalwarp EPSG:3857 KEWX_L2_VEL.tif KEWX_L2_VEL-projected.tif 

The original coordinates are identical and the scripts are identical (except for the filename of course) but I am trying not to rule anything out.

Is this something simple in the script that I should understand, what am I missing?

David
  • 232
  • 5
  • 21
  • Did you really use your commands as you wrote them into the question without using -t_srs? Corner coordinates of the warped and rotated images are not very useful for judging if the georeferencing if right or wrong because they are the corners of the final image which contain now also nodata areas. See for example https://gis.stackexchange.com/questions/131465/gdal-rotate-dem/131502#131502. Have you opened both warped images together with for example QGIS? Do they match? – user30184 Sep 13 '18 at 09:26
  • I actually did use -t_srs, although I am so new at this I don't know what it does. I had posted that I am new with this and need alot of help (and I am trying) but someone edited it out of my post. I dont understand why both geoTIF images with the same coordinates will not convert the same when using the same script. – David Sep 13 '18 at 09:30
  • I opened the warped images in QGIS, they do not match. the REF (good one) is much bigger. (I am trying to explain what I mean, but I am not experienced at all with this) – David Sep 13 '18 at 09:35
  • I could not repeat your problem with GDAL 2.4dev. Both output files have same extents. – user30184 Sep 13 '18 at 10:38
  • What was the script you used? I surely must have missed something then. I have still been trying the past hour. – David Sep 13 '18 at 10:42
  • I used your commands and the two images from gdal.zip that you provided. – user30184 Sep 13 '18 at 11:11
  • Would you mind pasting the command? If you used the same one I did, you would not have had a successful result. I need to understand what's going on. – David Sep 15 '18 at 09:50

1 Answers1

0

I do not understand how you can get your results. I did nothing differently than you did, except added the -s_srsparameter. If that is not used your command is interpreted so that EPSG:3857 is the source image and that leads to error so I do not believe that you have really used your command literally like you wrote it into the question.

ERROR 4: EPSG:3857: No such file or directory

I used the images from your gdal.zip package.

Gdalinfo about the source images:

Driver: GTiff/GeoTIFF
Files: KEWX_L2_REF.tif
Size is 4000, 3500
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-102.000000000000000,33.000000000000000)
Pixel Size = (0.002000000000000,-0.002000000000000)
Corner Coordinates:
Upper Left  (-102.0000000,  33.0000000) (102d 0' 0.00"W, 33d 0' 0.00"N)
Lower Left  (-102.0000000,  26.0000000) (102d 0' 0.00"W, 26d 0' 0.00"N)
Upper Right ( -94.0000000,  33.0000000) ( 94d 0' 0.00"W, 33d 0' 0.00"N)
Lower Right ( -94.0000000,  26.0000000) ( 94d 0' 0.00"W, 26d 0' 0.00"N)
Center      ( -98.0000000,  29.5000000) ( 98d 0' 0.00"W, 29d30' 0.00"N)

Driver: GTiff/GeoTIFF
Files: KEWX_L2_VEL.tif
Size is 4000, 3500
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-102.000000000000000,33.000000000000000)
Pixel Size = (0.002000000000000,-0.002000000000000)
Corner Coordinates:
Upper Left  (-102.0000000,  33.0000000) (102d 0' 0.00"W, 33d 0' 0.00"N)
Lower Left  (-102.0000000,  26.0000000) (102d 0' 0.00"W, 26d 0' 0.00"N)
Upper Right ( -94.0000000,  33.0000000) ( 94d 0' 0.00"W, 33d 0' 0.00"N)
Lower Right ( -94.0000000,  26.0000000) ( 94d 0' 0.00"W, 26d 0' 0.00"N)
Center      ( -98.0000000,  29.5000000) ( 98d 0' 0.00"W, 29d30' 0.00"N)

Your commands which I re-used

gdalwarp -t_srs EPSG:3857 KEWX_L2_REF.tif KEWX_L2_REF-projected.tif
gdalwarp -t_srs EPSG:3857 KEWX_L2_REF.tif KEWX_L2_REF-projected.tif

Shortened gdalinfo about the resulting GeoTIFFs

Driver: GTiff/GeoTIFF
Files: KEWX_L2_REF-projected.tif
Size is 3746, 3770
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
....
    AUTHORITY["EPSG","3857"]]
Origin = (-11354588.060913905501366,3895303.963393894489855)
Pixel Size = (237.710730685124162,-237.710730685124162)
Corner Coordinates:
Upper Left  (-11354588.061, 3895303.963) (102d 0' 0.00"W, 33d 0' 0.00"N)
Lower Left  (-11354588.061, 2999134.509) (102d 0' 0.00"W, 26d 0' 1.56"N)
Upper Right (-10464123.664, 3895303.963) ( 94d 0' 2.96"W, 33d 0' 0.00"N)
Lower Right (-10464123.664, 2999134.509) ( 94d 0' 2.96"W, 26d 0' 1.56"N)
Center      (-10909355.862, 3447219.236) ( 98d 0' 1.48"W, 29d33'38.89"N)


Driver: GTiff/GeoTIFF
Files: KEWX_L2_VEL-projected.tif
Size is 3746, 3770
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
....
    AUTHORITY["EPSG","3857"]]
Origin = (-11354588.060913905501366,3895303.963393894489855)
Pixel Size = (237.710730685124162,-237.710730685124162)
Corner Coordinates:
Upper Left  (-11354588.061, 3895303.963) (102d 0' 0.00"W, 33d 0' 0.00"N)
Lower Left  (-11354588.061, 2999134.509) (102d 0' 0.00"W, 26d 0' 1.56"N)
Upper Right (-10464123.664, 3895303.963) ( 94d 0' 2.96"W, 33d 0' 0.00"N)
Lower Right (-10464123.664, 2999134.509) ( 94d 0' 2.96"W, 26d 0' 1.56"N)
Center      (-10909355.862, 3447219.236) ( 98d 0' 1.48"W, 29d33'38.89"N)
user30184
  • 65,331
  • 4
  • 65
  • 118