<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi,<div><br></div><div>i'm reading a lot of sources from internet trying to explain how to make this transformation from coordintates as: </div><div><div>  V_LATITUDE = '9,54153844';</div><div>  V_LONGITUDE = '39,44322841';</div></div><div><br></div><div>Into UTM values. </div><div>We have a tiff map with a tfw file as follows:</div><div><div>50.0000000000</div><div>0.0000000000</div><div>0.0000000000</div><div>-50.0000000000</div><div>706876.2384142603</div><div>5976388.9235886401</div></div><div><br></div><div>As far as i read online, I've to use two <a href="http://www.gdal.org/classOGRSpatialReference.html" title="This class respresents a OpenGIS Spatial Reference System, and contains methods for converting betwee..." style="font-family:monospace,fixed;font-size:9pt;line-height:15px;color:rgb(70,101,162);text-decoration:none" target="_blank">OGRSpatialReference</a> using one as the "destination" format and the second one as source format. But I don't understand how to set up the "origin" reference to accept latitude and longitude.</div><div>From OGR tutorial i see this snippet:</div><div><br></div><div><pre style="font-family:monospace,fixed;font-size:9pt;border:1px solid rgb(196,207,229);padding:4px 6px;margin:4px 8px 4px 2px;overflow:auto;word-wrap:break-word;line-height:15px;color:rgb(0,0,0);background-color:rgb(251,252,253)">    <a href="http://www.gdal.org/classOGRSpatialReference.html" title="This class respresents a OpenGIS Spatial Reference System, and contains methods for converting betwee..." style="color:rgb(70,101,162);text-decoration:none" target="_blank">OGRSpatialReference</a>    oUTM, *poLatLong;
    <a href="http://www.gdal.org/classOGRCoordinateTransformation.html" title="Interface for transforming between coordinate systems." style="color:rgb(70,101,162);text-decoration:none" target="_blank">OGRCoordinateTransformation</a> *poTransform;

    oUTM.<a href="http://www.gdal.org/classOGRSpatialReference.html#a208118581246feb29646acf2ea5d4237" title="Set the user visible PROJCS name." style="color:rgb(70,101,162);text-decoration:none" target="_blank">SetProjCS</a>(<span style="color:rgb(0,32,128)">"UTM 17 / WGS84"</span>);
    oUTM.<a href="http://www.gdal.org/classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02" title="Set a GeogCS based on well known name." style="color:rgb(70,101,162);text-decoration:none" target="_blank">SetWellKnownGeogCS</a>( <span style="color:rgb(0,32,128)">"WGS84"</span> );
    oUTM.<a href="http://www.gdal.org/classOGRSpatialReference.html#a0c4f6fcab663c9eb6d465787cad3833c" title="Universal Transverse Mercator." style="color:rgb(70,101,162);text-decoration:none" target="_blank">SetUTM</a>( 17 );

    poLatLong = oUTM.<a href="http://www.gdal.org/classOGRSpatialReference.html#a0c1e2b108255487f91ae448f5c11f67c" title="Make a duplicate of the GEOGCS node of this OGRSpatialReference object." style="color:rgb(70,101,162);text-decoration:none" target="_blank">CloneGeogCS</a>();
    
    poTransform = <a href="http://www.gdal.org/ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f" title="Create transformation object." style="color:rgb(70,101,162);text-decoration:none" target="_blank">OGRCreateCoordinateTransformation</a>( &oUTM, poLatLong );
    <span style="color:rgb(224,128,0)">if</span>( poTransform == NULL )
    {
        ...
    }
    
    ...

    <span style="color:rgb(224,128,0)">if</span>( !poTransform-><a href="http://www.gdal.org/classOGRCoordinateTransformation.html#abf141396940b4f7b1f8118ea025d569b" title="Transform points from source to destination space." style="color:rgb(70,101,162);text-decoration:none" target="_blank">Transform</a>( nPoints, x, y, z ) )
    ...</pre></div><div><br></div><div>I know how to obtain UTM zone (as floor[(longitude+180)/6]+1) but i'm not understanding if the call to Transform will take my longitude/latitude values or if i'll obtain a "complete" transformation from a reference system to another. </div><div>The target is to access a GDALRasterBand and obtain a pixel value starting with returned coordinates.</div><div><br></div><div>Thanks and regards,</div><div>Pierpaolo</div><div><br></div></div>
</div><br></div>