#NEWLINE# def pixelToLatLng( raster_dataset , col , row ) : #NEWLINE# #INDENT# '\n      from http://zacharybears.com/using-python-to-translate-latlon-locations-to-pixels-on-a-geotiff/\n  ' #NEWLINE# ds = ct #NEWLINE# gt = ds . GetGeoTransform ( ) #NEWLINE# srs = osr . SpatialReference ( ) #NEWLINE# srs . ImportFromWkt ( ds . GetProjection ( ) ) #NEWLINE# srsLatLong = srs . CloneGeogCS ( ) #NEWLINE# ct = osr . CoordinateTransformation ( srs , srsLatLong ) #NEWLINE# ulon = ( ( col * gt [ 1 ] ) + gt [ 0 ] ) #NEWLINE# ulat = ( ( row * gt [ 5 ] ) + gt [ 3 ] ) #NEWLINE# ( lon , lat , holder ) = ct . TransformPoint ( ulon , ulat ) #NEWLINE# return ( lat , lon )