[Gdal-dev] Worldfile from SuperEdit + rotated images problems

Mateusz Łoskot mateusz at loskot.net
Mon Nov 7 12:04:24 EST 2005


Hi,

I have problems with translating JPG+JGW file to GeoTIFF
using GDAL utilities from FWTools 1.0.0a5.

My problem was also discussed a little with DronK on #gdal on IRC.
Unfortunately, it still isn't stied.
After some reserach I suspect SuperEdit causing the problem it generates
broken (incompatible) worldfile - JGW and rotation components.
Here you can download my sample raster calibrated by SuperEdit in JPG/JGW
format:

http://mateusz.loskot.net/chwila/superedit-sample-data.zip

(it will be available for a few weeks).

IMO, the JGW file is broken or of non-standard structure.
Please note, the JPG file is rotated.
Accordint to worldfile format description I interpred this file as follows

0.00000000000000 - x-scale
0.84666666666667 - rotation
0.84666666666667 - --//--
0.00000000000000 - y-scale
594958.12740300002000 - Easting and
373303.90045100002000 - Northing of the upper left pixel

Coordinates are in Poland CS992 - EPSG:2180

First, is this file correct?
Second, I am sure rotation components are required because the file is
rotatio
but why no pixel scales are given?

And what is the result of translation to GeoTIFF with gdal_translate?

I run following command on pair of files sheet.jpg/sheet.jgw:

#########################################################
D:\temp\superedit-sample-data>gdal_translate -of GTiff -a_srs "EPSG:2180"
sheet.
jpg test.tif
Input file size is 2888, 2823
0...10...20...30...40...50...60...70...80...90...100 - done.
#########################################################

And here is what gdalinfo says:

#########################################################
D:\temp\superedit-sample-data>gdalinfo test.tif
Driver: GTiff/GeoTIFF
Size is 2888, 2823
Coordinate System is:
PROJCS["ETRS89 / Poland CS92",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",19],
    PARAMETER["scale_factor",0.9993],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",-5300000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","2180"]]
GeoTransform =
  594957.7040696667, 0, 0.84666666666667
  373303.4771176667, 0.84666666666667, 0
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  (  594957.704,  373303.477) ( 20d21'36.33"E, 51d13'6.74"N)
Lower Left  (  597347.844,  373303.477) ( 20d23'39.54"E, 51d13'5.29"N)
Upper Right (  594957.704,  375748.650) ( 20d21'38.67"E, 51d14'25.90"N)
Lower Right (  597347.844,  375748.650) ( 20d23'41.93"E, 51d14'24.45"N)
Center      (  596152.774,  374526.064) ( 20d22'39.12"E, 51d13'45.60"N)
Band 1 Block=2888x2 Type=Byte, ColorInterp=Red
Band 2 Block=2888x2 Type=Byte, ColorInterp=Green
Band 3 Block=2888x2 Type=Byte, ColorInterp=Blue
#########################################################

I'm not able it it's correct or not. I only see definition of CS is correct.

And here comes the problem. When I open test.tif in ArcExplorer or QGIS I
don't see anything.
Raster is not displayed but also I get no error message.
So it seems GeoTIFF output is broken here.

Next, DronK suggested on #gdal that this sheet.jgw file is in wrong format
and I should
replace rotation with x/y-scale + there should be negative value in the
fourth field.
OK, I did it, and I have now JGW as follows:

0.84666666666667 - x-scale
0.00000000000000 - rotation
0.00000000000000 - --//--
-0.84666666666667 - y-scale
594958.12740300002000 - Easting and
373303.90045100002000 - Northing of the upper left pixel

Please note, this seems to not to be correct because my JPG is rotated (90
degrees clockwise).
But OK, I tried to translate it now:

#########################################################
D:\temp\superedit-sample-data>gdal_translate -of GTiff -a_srs "EPSG:2180"
sheet.
jpg test.tif
Input file size is 2888, 2823
0...10...20...30...40...50...60...70...80...90...100 - done.
#########################################################

And now gdal info says this:

#########################################################
D:\temp\superedit-sample-data>gdalinfo test.tif
Driver: GTiff/GeoTIFF
Size is 2888, 2823
Coordinate System is:
PROJCS["ETRS89 / Poland CS92",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",19],
    PARAMETER["scale_factor",0.9993],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",-5300000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","2180"]]
Origin = (594957.704070,373304.323784)
Pixel Size = (0.84666667,-0.84666667)
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  (  594957.704,  373304.324) ( 20d21'36.33"E, 51d13'6.77"N)
Lower Left  (  594957.704,  370914.184) ( 20d21'34.06"E, 51d11'49.39"N)
Upper Right (  597402.877,  373304.324) ( 20d23'42.38"E, 51d13'5.28"N)
Lower Right (  597402.877,  370914.184) ( 20d23'40.04"E, 51d11'47.91"N)
Center      (  596180.291,  372109.254) ( 20d22'38.20"E, 51d12'27.34"N)
Band 1 Block=2888x2 Type=Byte, ColorInterp=Red
Band 2 Block=2888x2 Type=Byte, ColorInterp=Green
Band 3 Block=2888x2 Type=Byte, ColorInterp=Blue
#########################################################

Here I also see correct CS but there is one small difference:

1. In the first output snippet:

GeoTransform =
  594957.7040696667, 0, 0.84666666666667
  373303.4771176667, 0.84666666666667, 0

2. In the second output snippet:

Origin = (594957.704070,373304.323784)
Pixel Size = (0.84666667,-0.84666667)

In this case I'm not sure which one is correct but now test.tif image is
displayed
well (almost) in both applications, ArcExplorer and QGIS.
Here are some screenshots:
http://mateusz.loskot.net/chwila/arcexplorer-rotated-raster.jpg
http://mateusz.loskot.net/chwila/qgis-rotated-raster.jpg

But please note, in both apps the test.tif is displayed rotated.
I don't know if latest versions of ArcExplorer and QGIS support
rotated images with worldfile.

My questions are:
1. Is this worldfile (JGW) generated by SuperEdit correct?
2. If not, does anybody know what is this format used by SuperEdit?
3. Is there any way to rerotate rotated images so, then I could use 0.0
rotation components?

Thanks for your help
Cheers

-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list