<div>Olá António Rocha,</div>This works for me, give it a try:<div>###########################################################</div><div><div>import os</div><div>try:</div><div> from osgeo import gdal</div><div> from osgeo import osr</div>
<div>except:</div><div> import gdal</div><div> import osr</div><div><br></div><div>def gdalinfo(pasta):</div><div> '''Le metadados com GDAL'''</div><div> ficheiros = os.listdir(pasta)</div>
<div> for ficheiro in ficheiros:</div><div> if ficheiro[-3:].lower() == 'tif':</div><div> # abrir imagem</div><div> filename = pasta+ficheiro</div><div> dataset = gdal.Open(filename, gdal.GA_ReadOnly)</div>
<div> if dataset is None:</div><div> print 'Nao foi possivel abrir a imagem %s!' % ficheiro</div><div> RasterXSize = dataset.RasterXSize</div><div> RasterYSize = dataset.RasterYSize</div>
<div> print RasterXSize,RasterYSize</div><div> print '\nfim'</div><div> return</div><div><br></div><div>gdalinfo('/home/eloi/Geo/raster/20790/')</div><div><br></div><div>###########################################################</div>
<div></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">2010/6/28 Mark Seibel <span dir="ltr"><<a href="mailto:mseibel@gmail.com">mseibel@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If you use gdalinfo on an image, it will output the "Pixel Size".<br>
<br>
Hope that helps.<br>
Mark<br>
<br>
2010/6/28 António Rocha <<a href="mailto:antonio.rocha@deimos.com.pt">antonio.rocha@deimos.com.pt</a>>:<br>
<div><div></div><div class="h5">> Greetings<br>
><br>
> I'm trying to retrieve an image (not yet imported to GRASS) pixel resolution<br>
> through a Python Script but so far i was unable to figure out a method to do<br>
> this. Is this possible? I have used g.proj to retrieve its projection and<br>
> datum but not the Pixel resolution.<br>
> THanks for your help<br>
><br>
> Best regards,<br>
> Antonio R.<br>
><br>
><br>
> __________ Information from ESET NOD32 Antivirus, version of virus signature<br>
> database 5234 (20100628) __________<br>
><br>
> The message was checked by ESET NOD32 Antivirus.<br>
><br>
> <a href="http://www.eset.com" target="_blank">http://www.eset.com</a><br>
><br>
><br>
> _______________________________________________<br>
> grass-user mailing list<br>
> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
><br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Eloi Ribeiro<br>GIS Analyst<br>39,45º -4,40º<br><a href="http://eloiribeiro.wordpress.com">http://eloiribeiro.wordpress.com</a><br>
</div>