[gdal-dev] A map conversion problem with GDAL 1.8.0

Corrado Guarino Lo Bianco guarino at ce.unipr.it
Mon Jun 6 07:52:27 EDT 2011


Hi Even,
I have forwarded your answer to the developers of QLandkarteGT, which 
changed the comparison approach in order to use OSRIsSame(). Now map and 
dem files pass the comparison test.
Thank you for your useful answer.

Corrado

Il 05/06/2011 14:18, Even Rouault ha scritto:
> Le dimanche 05 juin 2011 12:49:59, Corrado Guarino Lo Bianco a écrit :
>> Hi,
>> unfortunately this did not solve the problem. I try to better describe
>> the problem.
>> In order to decide if map and dem data files are compatible,
>> QLandkarteGT evaluate two strings from such files according to the
>> following procedure
>>
>> ...
>>       char str[1024];
>>       strncpy(str,dataset->GetProjectionRef(),sizeof(str));
>>       char * ptr = str;
>>       OGRSpatialReference oSRS;
>>       oSRS.importFromWkt(&ptr);
>>       oSRS.exportToProj4(&ptr);
>>       strOrigProj = strProj = ptr;
>> ...
>>
>> if the two strings coincides the two files are considered congruent.
>> In the case of the two files I'm managing, the following two strings are
>> obtained
>>
>> Map: +proj=utm +zone=32 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m
>> +no_defs
>> DEM: +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84
>> +towgs84=0,0,0
>>
>> As a consequence, nevertheless the two files are compatible the two
>> strings are different, so that dem data are rejected.
>>
>> The question is: is this the only way to check compatibility between
>> maps and dem data or there is a better and more robust solution?
> It is always difficult to ensure that 2 SRS are actually the "same" because very
> small changes with no real consequences can appear easily and break
> comparisons.
>
> As far as your above issue is concerned, I've observed that if you reimport
> the exported Proj4 string and then reexport it to Proj4, you get the same
> string...
>
> See the last line of the output of the 2 following commands ('PROJ.4 rendering
> of' line) :
>
> testepsg "+proj=utm +zone=32 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m
> +no_defs"
> testepsg "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84
> +towgs84=0,0,0"
>
> (For the record, there is a OSRIsSame() method too, that is the "normal" way
> of comparing 2 SRS, but it might also mark 2 SRS as different where they are
> considered equivalent for some purposes)
>
>
>> Corrado
>>
>>> Corrado,
>>>
>>> I see that the two projections are essentially the same. You may not need
>>> gdalwarp after all. Try the gdal_translate utility with the -a_srs option
>>> to specify the Coordinate System of the output file.
>>>
>>> Tell us how it goes.
>>>
>>> On Sat, Jun 4, 2011 at 3:30 PM, Corrado Guarino Lo Bianco<
>>>
>>> guarino at ce.unipr.it<http://lists.osgeo.org/mailman/listinfo/gdal-
> dev>>   wrote:
>>>> /  Hi all,
>>> />/  I'm a QLandkarteGT user (QLandkarteGT is based on GDAL) and I'm
>>> having a />/  problem related to map formats. I use ecw maps in
>>> conjunction with DEM data />/  stored in geotiff files. In the past I
>>> was using GDAL 1.7.2 and I had no />/  problems. Recently I switched to
>>> GDAL 1.8.0 and now QLandkarteGT says that />/  there is no matching
>>> between the projection used for the maps and that used />/  for DEM
>>> data, nevertheless I'm still adopting the same files. By means of />/
>>> gdalwarp, I have made several unsuccessful attempts to convert DEM data
>>> into />/  a format suitable to be used in conjunction with ecw maps.
>>> />/  Can someone help me?
>>> />/  These are the outputs I get from the ecw and the tiff files when I
>>> run />/  gdalinfo:
>>> />/
>>> />/  Driver: ECW/ERDAS Compressed Wavelets (SDK 3.x)
>>> />/  Files: /media/IGM 25000/IGM 25.000 - Emilia Romagna.ecw
>>> />/  Size is 96000, 64000
>>> />/  Coordinate System is:
>>> />/  PROJCS["NUTM32",
>>> />/     GEOGCS["WGS 84",
>>> />/         DATUM["WGS_1984",
>>> />/             SPHEROID["WGS 84",6378137,298.257223563,
>>> />/                 AUTHORITY["EPSG","7030"]],
>>> />/             TOWGS84[0,0,0,0,0,0,0],
>>> />/             AUTHORITY["EPSG","6326"]],
>>> />/         PRIMEM["Greenwich",0,
>>> />/             AUTHORITY["EPSG","8901"]],
>>> />/         UNIT["degree",0.0174532925199433,
>>> />/             AUTHORITY["EPSG","9108"]],
>>> />/         AXIS["Lat",NORTH],
>>> />/         AXIS["Long",EAST],
>>> />/         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["Meter",1]]
>>> />/  Origin = (510000.000000000000000,5000000.000000000000000)
>>> />/  Pixel Size = (2.500000000000000,-2.500000000000000)
>>> />/  Corner Coordinates:
>>> />/  Upper Left  (  510000.000, 5000000.000) (  9d 7'37.99"E, 45d
>>> 9'12.26"N) />/  Lower Left  (  510000.000, 4840000.000) (  9d 7'26.87"E,
>>> 43d42'46.65"N) />/  Upper Right (  750000.000, 5000000.000) (
>>> 12d10'40.88"E, 45d 6'33.26"N) />/  Lower Right (  750000.000,
>>> 4840000.000) ( 12d 6' 3.79"E, 43d40'15.39"N) />/  Center      (
>>> 630000.000, 4920000.000) ( 10d37'59.07"E, 44d25'17.84"N) />/  Band 1
>>> Block=96000x1 Type=Byte, ColorInterp=Red
>>> />/   Overviews: 48000x32000, 24000x16000, 12000x8000, 6000x4000,
>>> 3000x2000, />/  1500x1000, 750x500, 375x250
>>> />/  Band 2 Block=96000x1 Type=Byte, ColorInterp=Green
>>> />/   Overviews: 48000x32000, 24000x16000, 12000x8000, 6000x4000,
>>> 3000x2000, />/  1500x1000, 750x500, 375x250
>>> />/  Band 3 Block=96000x1 Type=Byte, ColorInterp=Blue
>>> />/   Overviews: 48000x32000, 24000x16000, 12000x8000, 6000x4000,
>>> 3000x2000, />/  1500x1000, 750x500, 375x250
>>> />/
>>> />/
>>> />/
>>> />/  Driver: GTiff/GeoTIFF
>>> />/  Files: /media/Dati/Documenti/gps tuner/Altimetrie Italia/Emilia
>>> />/  Romagna/Emilia_Romagna.tif
>>> />/  Size is 4074, 4262
>>> />/  Coordinate System is:
>>> />/  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],
>>> />/         UNIT["degree",0.0174532925199433],
>>> />/         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"]],
>>> />/     AUTHORITY["EPSG","32632"]]
>>> />/  Origin = (499966.037957447464578,5101878.644408876076341)
>>> />/  Pixel Size = (80.031641738007920,-80.031641738007920)
>>> />/  Metadata:
>>> />/   AREA_OR_POINT=Area
>>> />/  Image Structure Metadata:
>>> />/   COMPRESSION=DEFLATE
>>> />/   INTERLEAVE=BAND
>>> />/  Corner Coordinates:
>>> />/  Upper Left  (  499966.038, 5101878.644) (  8d59'58.42"E, 46d
>>> 4'13.74"N) />/  Lower Left  (  499966.038, 4760783.787) (  8d59'58.50"E,
>>> 42d59'58.99"N) />/  Upper Right (  826014.946, 5101878.644) (
>>> 13d12'35.68"E, 45d59'34.36"N) />/  Lower Right (  826014.946,
>>> 4760783.787) ( 12d59'42.00"E, 42d55'47.82"N) />/  Center      (
>>> 662990.492, 4931331.216) ( 11d 3' 3.01"E, 44d31' 0.81"N) />/  Band 1
>>> Block=256x256 Type=Int16, ColorInterp=Gray
>>> />/
>>> />/
>>> />/  Thank you for your help,
>>> />/  Corrado
>>> />/
>>> />/  _______________________________________________
>>> />/  gdal-dev mailing list
>>> />/  gdal-dev at lists.osgeo.org
>>> <http://lists.osgeo.org/mailman/listinfo/gdal-dev>  />/
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>> />/
>>> /



More information about the gdal-dev mailing list