[Gdal-dev] Warping a warped file C# bindings

edomazlicky edomazlicky at gmail.com
Wed Jun 3 14:13:51 EDT 2009


Tamas-
 I've done some futher tracking on this and I found out the problem seems to
actually be a difference in how the SVN version of GDAL warps and how an
older development version warps. I warped the USGS DRG file for Mount
Rainier West- available here:
http://rocky.ess.washington.edu/data/raster/drg/yakima/o46121g7.zip

to EPSG:32610 (WGS84 UTM Zone 10N)- these files were NAD27 UTM Zone 10N to
start out. On a pixel by pixel basis the files are exactly the same- but if
you examine the GDALInfo output I attached you will see the Origin data
written to the files is almost 100 Meters off the Northing dimension, and
about 50 meters off the Easting dimension. If you plot a coordinate into the
reprojected maps (the summit of Rainier works well) you can see the old
version reprojects correctly, the new version is off by a significant
amount.
Summit coordinates should be: 46.852778, -121.760278

I'm not sure the exact versions of the library I'm using but the old version
that seems to work is from FWTools 2.3.0 and the new SVN version is from a
recent automated Windows build SDK built on 6/1/09.
On Tue, Jun 2, 2009 at 2:30 PM, Tamas Szekeres (via Nabble) <
ml-user+63011-1539807046 at n2.nabble.com<ml-user%2B63011-1539807046 at n2.nabble.com>
> wrote:

> Hi,
>
> I'm not sure about this problem, I suspect cascading the vrt datasets
> should normally work. Could you provide your complete C# example to produce
> the output and the gdal_warp command line to examine the difference?
>
> Best regards,
>
> Tamas
>
>
>
> 2009/5/31 edomazlicky <edomazlicky at ...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3014818&i=0>
> >
>
>>
>> I am trying to warp a NAD27 UTM file to Google Mercator 900913. My
>> understanding is that for this to happen you have to first warp the file
>> to
>> WGS84 and then to 900913. I have tried going straight from NAD27->900913
>> and
>> I get projection errors similar to if you plotted a WGS84 coordinate on a
>> NAD27 map. So to accomplish this two-step warp I have been trying to do
>> something kind of like this:
>>
>> Dim oWGS84 As New OSGeo.OSR.SpatialReference("")
>> ' WGS84 UTM Zone 10
>> oWGS84.ImportFromEPSG(32610)
>> Dim wgs84_wkt As String = ""
>> oWGS84.ExportToPrettyWkt(wgs84_wkt, 0)
>> InterMed = OSGeo.GDAL.Gdal.AutoCreateWarpedVRT(SrcGdalDataSet, src_wkt,
>> wgs84_wkt, eReSample, 0.125)
>> GdalDataSet = OSGeo.GDAL.Gdal.AutoCreateWarpedVRT(InterMed, wgs84_wkt,
>> dst_wkt, eReSample, 0.125)
>>
>> Where src_wkt contains the NAD27 WKT and dst_wkt contains the 900913 WKT.
>> This doesn't work- I am getting the same results I get if I try to go
>> straight from NAD27->900913. However if instead I warp the file in
>> gdal_warp
>> first to WGS84 and then go from that to 900913 it works fine. Is there
>> anyway to warp these files without making a new file fist? I would like
>> for
>> it all to be done in memory without messing with temporary files or
>> calling
>> gdal_warp externally.
>> --
>> View this message in context:
>> http://n2.nabble.com/Warping-a-warped-file-C--bindings-tp3003215p3003215.html
>> Sent from the GDAL - Dev mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at ...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3014818&i=1>
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at ...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3014818&i=2>
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> ------------------------------
> This email is a reply to your post @
> http://n2.nabble.com/Warping-a-warped-file-C--bindings-tp3003215p3014818.html
> You can reply by email or by visting the link above.
>
>

Driver: GTiff/GeoTIFF
Files: o46121g7_new.tif
Size is 5212, 6818
Coordinate System is:
PROJCS["WGS 84 / UTM zone 10N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                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",-123],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32610"]]
Origin = (584721.349063829520000,5192851.955712453500000)
Pixel Size = (2.438380511827829,-2.438380511827829)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  584721.349, 5192851.956) (121d53'16.89"W, 46d53'1.69"N)
Lower Left  (  584721.349, 5176227.077) (121d53'27.97"W, 46d44'3.21"N)
Upper Right (  597430.188, 5192851.956) (121d43'16.53"W, 46d52'55.42"N)
Lower Right (  597430.188, 5176227.077) (121d43'29.28"W, 46d43'56.97"N)
Center      (  591075.769, 5184539.517) (121d48'22.67"W, 46d48'29.43"N)
Band 1 Block=5212x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 255,255,255,255
    2: 0,151,164,255
    3: 203,0,23,255
    4: 131,66,37,255
    5: 201,234,157,255
    6: 137,51,128,255
    7: 255,234,0,255
    8: 167,226,226,255
    9: 255,184,184,255
   10: 218,179,214,255
   11: 209,209,209,255
   12: 207,164,142,255
   13: 0,0,0,255
   14: 0,0,0,255
   15: 0,0,0,255
   16: 0,0,0,255
   17: 0,0,0,255
   18: 0,0,0,255
   19: 0,0,0,255
   20: 0,0,0,255
   21: 0,0,0,255
   22: 0,0,0,255
   23: 0,0,0,255
   24: 0,0,0,255
   25: 0,0,0,255
   26: 0,0,0,255
   27: 0,0,0,255
   28: 0,0,0,255
   29: 0,0,0,255
   30: 0,0,0,255
   31: 0,0,0,255
   32: 0,0,0,255
   33: 0,0,0,255
   34: 0,0,0,255
   35: 0,0,0,255
   36: 0,0,0,255
   37: 0,0,0,255
   38: 0,0,0,255
   39: 0,0,0,255
   40: 0,0,0,255
   41: 0,0,0,255
   42: 0,0,0,255
   43: 0,0,0,255
   44: 0,0,0,255
   45: 0,0,0,255
   46: 0,0,0,255
   47: 0,0,0,255
   48: 0,0,0,255
   49: 0,0,0,255
   50: 0,0,0,255
   51: 0,0,0,255
   52: 0,0,0,255
   53: 0,0,0,255
   54: 0,0,0,255
   55: 0,0,0,255
   56: 0,0,0,255
   57: 0,0,0,255
   58: 0,0,0,255
   59: 0,0,0,255
   60: 0,0,0,255
   61: 0,0,0,255
   62: 0,0,0,255
   63: 0,0,0,255
   64: 0,0,0,255
   65: 0,0,0,255
   66: 0,0,0,255
   67: 0,0,0,255
   68: 0,0,0,255
   69: 0,0,0,255
   70: 0,0,0,255
   71: 0,0,0,255
   72: 0,0,0,255
   73: 0,0,0,255
   74: 0,0,0,255
   75: 0,0,0,255
   76: 0,0,0,255
   77: 0,0,0,255
   78: 0,0,0,255
   79: 0,0,0,255
   80: 0,0,0,255
   81: 0,0,0,255
   82: 0,0,0,255
   83: 0,0,0,255
   84: 0,0,0,255
   85: 0,0,0,255
   86: 0,0,0,255
   87: 0,0,0,255
   88: 0,0,0,255
   89: 0,0,0,255
   90: 0,0,0,255
   91: 0,0,0,255
   92: 0,0,0,255
   93: 0,0,0,255
   94: 0,0,0,255
   95: 0,0,0,255
   96: 0,0,0,255
   97: 0,0,0,255
   98: 0,0,0,255
   99: 0,0,0,255
  100: 0,0,0,255
  101: 0,0,0,255
  102: 0,0,0,255
  103: 0,0,0,255
  104: 0,0,0,255
  105: 0,0,0,255
  106: 0,0,0,255
  107: 0,0,0,255
  108: 0,0,0,255
  109: 0,0,0,255
  110: 0,0,0,255
  111: 0,0,0,255
  112: 0,0,0,255
  113: 0,0,0,255
  114: 0,0,0,255
  115: 0,0,0,255
  116: 0,0,0,255
  117: 0,0,0,255
  118: 0,0,0,255
  119: 0,0,0,255
  120: 0,0,0,255
  121: 0,0,0,255
  122: 0,0,0,255
  123: 0,0,0,255
  124: 0,0,0,255
  125: 0,0,0,255
  126: 0,0,0,255
  127: 0,0,0,255
  128: 0,0,0,255
  129: 0,0,0,255
  130: 0,0,0,255
  131: 0,0,0,255
  132: 0,0,0,255
  133: 0,0,0,255
  134: 0,0,0,255
  135: 0,0,0,255
  136: 0,0,0,255
  137: 0,0,0,255
  138: 0,0,0,255
  139: 0,0,0,255
  140: 0,0,0,255
  141: 0,0,0,255
  142: 0,0,0,255
  143: 0,0,0,255
  144: 0,0,0,255
  145: 0,0,0,255
  146: 0,0,0,255
  147: 0,0,0,255
  148: 0,0,0,255
  149: 0,0,0,255
  150: 0,0,0,255
  151: 0,0,0,255
  152: 0,0,0,255
  153: 0,0,0,255
  154: 0,0,0,255
  155: 0,0,0,255
  156: 0,0,0,255
  157: 0,0,0,255
  158: 0,0,0,255
  159: 0,0,0,255
  160: 0,0,0,255
  161: 0,0,0,255
  162: 0,0,0,255
  163: 0,0,0,255
  164: 0,0,0,255
  165: 0,0,0,255
  166: 0,0,0,255
  167: 0,0,0,255
  168: 0,0,0,255
  169: 0,0,0,255
  170: 0,0,0,255
  171: 0,0,0,255
  172: 0,0,0,255
  173: 0,0,0,255
  174: 0,0,0,255
  175: 0,0,0,255
  176: 0,0,0,255
  177: 0,0,0,255
  178: 0,0,0,255
  179: 0,0,0,255
  180: 0,0,0,255
  181: 0,0,0,255
  182: 0,0,0,255
  183: 0,0,0,255
  184: 0,0,0,255
  185: 0,0,0,255
  186: 0,0,0,255
  187: 0,0,0,255
  188: 0,0,0,255
  189: 0,0,0,255
  190: 0,0,0,255
  191: 0,0,0,255
  192: 0,0,0,255
  193: 0,0,0,255
  194: 0,0,0,255
  195: 0,0,0,255
  196: 0,0,0,255
  197: 0,0,0,255
  198: 0,0,0,255
  199: 0,0,0,255
  200: 0,0,0,255
  201: 0,0,0,255
  202: 0,0,0,255
  203: 0,0,0,255
  204: 0,0,0,255
  205: 0,0,0,255
  206: 0,0,0,255
  207: 0,0,0,255
  208: 0,0,0,255
  209: 0,0,0,255
  210: 0,0,0,255
  211: 0,0,0,255
  212: 0,0,0,255
  213: 0,0,0,255
  214: 0,0,0,255
  215: 0,0,0,255
  216: 0,0,0,255
  217: 0,0,0,255
  218: 0,0,0,255
  219: 0,0,0,255
  220: 0,0,0,255
  221: 0,0,0,255
  222: 0,0,0,255
  223: 0,0,0,255
  224: 0,0,0,255
  225: 0,0,0,255
  226: 0,0,0,255
  227: 0,0,0,255
  228: 0,0,0,255
  229: 0,0,0,255
  230: 0,0,0,255
  231: 0,0,0,255
  232: 0,0,0,255
  233: 0,0,0,255
  234: 0,0,0,255
  235: 0,0,0,255
  236: 0,0,0,255
  237: 0,0,0,255
  238: 0,0,0,255
  239: 0,0,0,255
  240: 0,0,0,255
  241: 0,0,0,255
  242: 0,0,0,255
  243: 0,0,0,255
  244: 0,0,0,255
  245: 0,0,0,255
  246: 0,0,0,255
  247: 0,0,0,255
  248: 0,0,0,255
  249: 0,0,0,255
  250: 0,0,0,255
  251: 0,0,0,255
  252: 0,0,0,255
  253: 0,0,0,255
  254: 0,0,0,255
  255: 0,0,0,255

Driver: GTiff/GeoTIFF
Files: o46121g7_old.tif
Size is 5212, 6818
Coordinate System is:
PROJCS["WGS 84 / UTM zone 10N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                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",-123],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32610"]]
Origin = (584629.033300812820000,5192831.629261755400000)
Pixel Size = (2.438409423764617,-2.438409423764617)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  584629.033, 5192831.629) (121d53'21.26"W, 46d53'1.08"N)
Lower Left  (  584629.033, 5176206.554) (121d53'32.33"W, 46d44'2.58"N)
Upper Right (  597338.023, 5192831.629) (121d43'20.90"W, 46d52'54.81"N)
Lower Right (  597338.023, 5176206.554) (121d43'33.64"W, 46d43'56.35"N)
Center      (  590983.528, 5184519.092) (121d48'27.04"W, 46d48'28.82"N)
Band 1 Block=5212x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 255,255,255,255
    2: 0,151,164,255
    3: 203,0,23,255
    4: 131,66,37,255
    5: 201,234,157,255
    6: 137,51,128,255
    7: 255,234,0,255
    8: 167,226,226,255
    9: 255,184,184,255
   10: 218,179,214,255
   11: 209,209,209,255
   12: 207,164,142,255
   13: 0,0,0,255
   14: 0,0,0,255
   15: 0,0,0,255
   16: 0,0,0,255
   17: 0,0,0,255
   18: 0,0,0,255
   19: 0,0,0,255
   20: 0,0,0,255
   21: 0,0,0,255
   22: 0,0,0,255
   23: 0,0,0,255
   24: 0,0,0,255
   25: 0,0,0,255
   26: 0,0,0,255
   27: 0,0,0,255
   28: 0,0,0,255
   29: 0,0,0,255
   30: 0,0,0,255
   31: 0,0,0,255
   32: 0,0,0,255
   33: 0,0,0,255
   34: 0,0,0,255
   35: 0,0,0,255
   36: 0,0,0,255
   37: 0,0,0,255
   38: 0,0,0,255
   39: 0,0,0,255
   40: 0,0,0,255
   41: 0,0,0,255
   42: 0,0,0,255
   43: 0,0,0,255
   44: 0,0,0,255
   45: 0,0,0,255
   46: 0,0,0,255
   47: 0,0,0,255
   48: 0,0,0,255
   49: 0,0,0,255
   50: 0,0,0,255
   51: 0,0,0,255
   52: 0,0,0,255
   53: 0,0,0,255
   54: 0,0,0,255
   55: 0,0,0,255
   56: 0,0,0,255
   57: 0,0,0,255
   58: 0,0,0,255
   59: 0,0,0,255
   60: 0,0,0,255
   61: 0,0,0,255
   62: 0,0,0,255
   63: 0,0,0,255
   64: 0,0,0,255
   65: 0,0,0,255
   66: 0,0,0,255
   67: 0,0,0,255
   68: 0,0,0,255
   69: 0,0,0,255
   70: 0,0,0,255
   71: 0,0,0,255
   72: 0,0,0,255
   73: 0,0,0,255
   74: 0,0,0,255
   75: 0,0,0,255
   76: 0,0,0,255
   77: 0,0,0,255
   78: 0,0,0,255
   79: 0,0,0,255
   80: 0,0,0,255
   81: 0,0,0,255
   82: 0,0,0,255
   83: 0,0,0,255
   84: 0,0,0,255
   85: 0,0,0,255
   86: 0,0,0,255
   87: 0,0,0,255
   88: 0,0,0,255
   89: 0,0,0,255
   90: 0,0,0,255
   91: 0,0,0,255
   92: 0,0,0,255
   93: 0,0,0,255
   94: 0,0,0,255
   95: 0,0,0,255
   96: 0,0,0,255
   97: 0,0,0,255
   98: 0,0,0,255
   99: 0,0,0,255
  100: 0,0,0,255
  101: 0,0,0,255
  102: 0,0,0,255
  103: 0,0,0,255
  104: 0,0,0,255
  105: 0,0,0,255
  106: 0,0,0,255
  107: 0,0,0,255
  108: 0,0,0,255
  109: 0,0,0,255
  110: 0,0,0,255
  111: 0,0,0,255
  112: 0,0,0,255
  113: 0,0,0,255
  114: 0,0,0,255
  115: 0,0,0,255
  116: 0,0,0,255
  117: 0,0,0,255
  118: 0,0,0,255
  119: 0,0,0,255
  120: 0,0,0,255
  121: 0,0,0,255
  122: 0,0,0,255
  123: 0,0,0,255
  124: 0,0,0,255
  125: 0,0,0,255
  126: 0,0,0,255
  127: 0,0,0,255
  128: 0,0,0,255
  129: 0,0,0,255
  130: 0,0,0,255
  131: 0,0,0,255
  132: 0,0,0,255
  133: 0,0,0,255
  134: 0,0,0,255
  135: 0,0,0,255
  136: 0,0,0,255
  137: 0,0,0,255
  138: 0,0,0,255
  139: 0,0,0,255
  140: 0,0,0,255
  141: 0,0,0,255
  142: 0,0,0,255
  143: 0,0,0,255
  144: 0,0,0,255
  145: 0,0,0,255
  146: 0,0,0,255
  147: 0,0,0,255
  148: 0,0,0,255
  149: 0,0,0,255
  150: 0,0,0,255
  151: 0,0,0,255
  152: 0,0,0,255
  153: 0,0,0,255
  154: 0,0,0,255
  155: 0,0,0,255
  156: 0,0,0,255
  157: 0,0,0,255
  158: 0,0,0,255
  159: 0,0,0,255
  160: 0,0,0,255
  161: 0,0,0,255
  162: 0,0,0,255
  163: 0,0,0,255
  164: 0,0,0,255
  165: 0,0,0,255
  166: 0,0,0,255
  167: 0,0,0,255
  168: 0,0,0,255
  169: 0,0,0,255
  170: 0,0,0,255
  171: 0,0,0,255
  172: 0,0,0,255
  173: 0,0,0,255
  174: 0,0,0,255
  175: 0,0,0,255
  176: 0,0,0,255
  177: 0,0,0,255
  178: 0,0,0,255
  179: 0,0,0,255
  180: 0,0,0,255
  181: 0,0,0,255
  182: 0,0,0,255
  183: 0,0,0,255
  184: 0,0,0,255
  185: 0,0,0,255
  186: 0,0,0,255
  187: 0,0,0,255
  188: 0,0,0,255
  189: 0,0,0,255
  190: 0,0,0,255
  191: 0,0,0,255
  192: 0,0,0,255
  193: 0,0,0,255
  194: 0,0,0,255
  195: 0,0,0,255
  196: 0,0,0,255
  197: 0,0,0,255
  198: 0,0,0,255
  199: 0,0,0,255
  200: 0,0,0,255
  201: 0,0,0,255
  202: 0,0,0,255
  203: 0,0,0,255
  204: 0,0,0,255
  205: 0,0,0,255
  206: 0,0,0,255
  207: 0,0,0,255
  208: 0,0,0,255
  209: 0,0,0,255
  210: 0,0,0,255
  211: 0,0,0,255
  212: 0,0,0,255
  213: 0,0,0,255
  214: 0,0,0,255
  215: 0,0,0,255
  216: 0,0,0,255
  217: 0,0,0,255
  218: 0,0,0,255
  219: 0,0,0,255
  220: 0,0,0,255
  221: 0,0,0,255
  222: 0,0,0,255
  223: 0,0,0,255
  224: 0,0,0,255
  225: 0,0,0,255
  226: 0,0,0,255
  227: 0,0,0,255
  228: 0,0,0,255
  229: 0,0,0,255
  230: 0,0,0,255
  231: 0,0,0,255
  232: 0,0,0,255
  233: 0,0,0,255
  234: 0,0,0,255
  235: 0,0,0,255
  236: 0,0,0,255
  237: 0,0,0,255
  238: 0,0,0,255
  239: 0,0,0,255
  240: 0,0,0,255
  241: 0,0,0,255
  242: 0,0,0,255
  243: 0,0,0,255
  244: 0,0,0,255
  245: 0,0,0,255
  246: 0,0,0,255
  247: 0,0,0,255
  248: 0,0,0,255
  249: 0,0,0,255
  250: 0,0,0,255
  251: 0,0,0,255
  252: 0,0,0,255
  253: 0,0,0,255
  254: 0,0,0,255
  255: 0,0,0,255

-- 
View this message in context: http://n2.nabble.com/Warping-a-warped-file-C--bindings-tp3003215p3020052.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090603/a4f8a050/attachment-0001.html


More information about the gdal-dev mailing list