Skip to content

Instantly share code, notes, and snippets.

@esisa
Created October 9, 2012 11:43
Show Gist options
  • Save esisa/3858224 to your computer and use it in GitHub Desktop.
Save esisa/3858224 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from osgeo import gdal
# Read raster
source = gdal.Open('raster.tif')
nx, ny = source.RasterXSize, source.RasterYSize
band_array = source.GetRasterBand(1).ReadAsArray()
# Close raster
source = None
print "Antall piksler: " , nx, ny
print "Høyde i første piksel: " , band_array[0][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment