I have a city map in Cassini_Soldner projection with a separate file containing 
the Soldner coordinates of the 4 corners.
I want to reproject it to WGS84 in order to render it e.g. with SharpMap and 
display some GPS positions.
I have tried it with some different parameter settings of gdalwarp but in every 
case the resulting image is distorted (the size of the generated tif is 
decreased to 15141, 6943).
Even if with the parameter -ts 15118 11339 the original size is adjusted 
SharpMap or QGis will display it distorted (IrfanView without distortion).

Is there another way to get a non distorted image or what did I wrong?

Martin

..\FWTools2.4.2\bin>gdalinfo pic.tif
Driver: GTiff/GeoTIFF
Files: pic.tif
Size is 15118, 11339
Coordinate System is `'
Metadata:
  TIFFTAG_SOFTWARE=IrfanView
  TIFFTAG_XRESOLUTION=600
  TIFFTAG_YRESOLUTION=600
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,11339.0)
Upper Right (15118.0,    0.0)
Lower Right (15118.0,11339.0)
Center      ( 7559.0, 5669.5)
Band 1 Block=15118x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 1,1,1,255


gcp     mapX    mapY    pixelX  pixelY
------------------------------------------------
upper left      27200   17200   0       0
upper right     30400   17200   15118   0
lower right     30400   14800   15118   -11339
lower left      27200   14800   0       -11339


Gcp     mapX    mapY    pixelX  pixelY
-------------------------------------------------------
upper left 13.4370322252183 52.4818154665202 0 0
upper right 13.4841338099227 52.4818815506509 15118 0
lower right 13.4842034283538 52.4603136448411 15118 -11339
lower left 13.4371248633278 52.4602476117909 0 -11339

First I use gdal_translate to add the corner pixel coordinates in WGS84 to the 
file as ground control points:

..\FWTools2.4.2\bin>gdal_translate pic.tif pic_gcp.tif
-gcp 0 0 13.4370322252183 52.4818154665202
-gcp 15118 0 13.4841338099227 52.4818815506509
-gcp 15118 11339 13.4842034283538 52.4603136448411
-gcp 0 11339 13.4371248633278 52.4602476117909

..\FWTools2.4.2\bin>gdalinfo pic_gcp.tif
Driver: GTiff/GeoTIFF
Files: pic_gcp.tif
Size is 15118, 11339
Coordinate System is `'
GCP Projection =
GCP[  0]: Id=1, Info= (0,0) -> (13.4370322252183,52.4818154665202,0)
GCP[  1]: Id=2, Info= (15118,0) -> (13.4841338099227,52.4818815506509,0)
GCP[  2]: Id=3, Info= (15118,11339) -> (13.4842034283538,52.4603136448411,0)
GCP[  3]: Id=4, Info= (0,11339) -> (13.4371248633278,52.4602476117909,0)
Metadata:
  TIFFTAG_SOFTWARE=IrfanView
  TIFFTAG_XRESOLUTION=600
  TIFFTAG_YRESOLUTION=600
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,11339.0)
Upper Right (15118.0,    0.0)
Lower Right (15118.0,11339.0)
Center      ( 7559.0, 5669.5)
Band 1 Block=15118x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 1,1,1,255

To perform the transformation I call gdalwarp
note:
-s_srs: By giving the ground control points in WGS84 coordinates the original 
Soldner projection has been discarded.
-tr: sets target resolution equal in x- and y- directions to get a non 
distorted picture

gdalwarp -s_srs EPSG:4326 -t_srs EPSG:4326 -tr 0.000003115596289 
0.000003115596289 pic_gcp.tif result2.tif
Copying color table from pic_gcp.tif to new file.
Creating output file that is 15141P x 6943L.
Processing input file pic_gcp.tif.
0...10...20...30...40...50...60...70...80...90...100 - done.

..\FWTools2.4.2\bin>gdalinfo result2.tif
Driver: GTiff/GeoTIFF
Files: result2.tif
Size is 15141, 6943
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 = (13.437037980137905,52.481881537880760)
Pixel Size = (0.000003115596289,-0.000003115596289)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  13.4370380,  52.4818815) ( 13d26'13.34"E, 52d28'54.77"N)
Lower Left  (  13.4370380,  52.4602500) ( 13d26'13.34"E, 52d27'36.90"N)
Upper Right (  13.4842112,  52.4818815) ( 13d29'3.16"E, 52d28'54.77"N)
Lower Right (  13.4842112,  52.4602500) ( 13d29'3.16"E, 52d27'36.90"N)
Center      (  13.4606246,  52.4710657) ( 13d27'38.25"E, 52d28'15.84"N)
Band 1 Block=15141x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 1,1,1,255


-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to