<div><br>Hello Travis!</div>
<div> </div>
<div>Thank you for your help, I already took a look to the links you suggested me, I found them interesting and help me a little with my problem, the second link hepeld me a lot because I can solved 2 of the coordinates I need. But now I don't know how to define x_max and y_min, I developed a operation to find it, but this will only work if the rasters pixel is in meters:</div>
<div> </div>
<div>import os</div>
<div>from osgeo import gdal<br>from osgeo.gdalconst import *<br></div>
<div>dataset = gdal.Open(filepath, GA_ReadOnly)<br> geotransform = dataset.GetGeoTransform()</div>
<div>x_min = geotransform[0]<br>y_max = geotransform[3]<br>pixel_width = geotransform[1]<br>pixel_height = geotransform[5]<br> <br> rows = dataset.RasterYSize<br> cols = dataset.RasterXSize<br> bands = dataset.RasterCount<br>
<br> x_max = (cols*pixel_width) + x_min<br> y_min = y_max + (rows*pixel_height)<br><br>The last two lines work for those coordinates, but won't work for all cases.</div>
<div class="gmail_quote">2010/10/21 Travis Kirstine <span dir="ltr"><<a href="mailto:tkirstine@firstbasesolutions.com">tkirstine@firstbasesolutions.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Susana,<br>The GetGeoTransform will return the upper left coordinate and pixel size. RasterXSize and RasterYSize will return the number of pixels. You can calculate the extents from all this information.<br>
<br><a href="http://www.gdal.org/gdal_tutorial.html" target="_blank">http://www.gdal.org/gdal_tutorial.html</a><br><a href="http://www.gdal.org/classGDALDataset.html#f9593cc241e7d140f5f3c4798a43a668" target="_blank">http://www.gdal.org/classGDALDataset.html#f9593cc241e7d140f5f3c4798a43a668</a><br>
<br><br>Regards
<div>
<div></div>
<div class="h5"><br><br><br><br>Susana Iraiis Delgado Rodriguez wrote:<br></div></div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div class="h5">Hello list!<br> I´m working in a python module to read rasters and get information out of them. I'm using GDAL and some of the osgeo libraries. I already have the ratsers' projection, but I also need its extent (x_min, y_min, x_max, y_max).<br>
I have been searching in google and don't have any results. My code is:<br> from osgeo import gdal<br>from osgeo.gdalconst import *<br> gdal.AllRegister()<br>dataset = gdal.Open(filepath, GA_ReadOnly)<br>if dataset:<br>
</div></div> ------------------------------------------------------------------------<br><br>_______________________________________________<br>FWTools mailing list<br><a href="mailto:FWTools@lists.maptools.org" target="_blank">FWTools@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/fwtools" target="_blank">http://lists.maptools.org/mailman/listinfo/fwtools</a><br><a href="http://fwtools.maptools.org/" target="_blank">http://fwtools.maptools.org/</a><br>
<br></blockquote></blockquote></div><br>