I need to output my numpy array as a raster so that someone else can access the data in ArcGIS. So basically the steps I need are:<br>read numpy array into gdal<br>convert to raster<br>use latitude and longitude and array size to set projection<br>
<br>I am really struggling with gdal because I can't seem to find enough documentation about each step to understand what it is doing. <br>Here are some of the steps I think I need:<br><br>myarray=myarray<br>#the extent and shape of my array<br>
xmin,ymin,xmax,ymax=[139.8,-39.2,150.0,-33.6]<br>ncols,nrows=[193,106]<br>xres=(xmax-xmin)/float(ncols)<br>yres=(ymax-ymin)/float(nrows)<br>geotransform=(xmin,xres,0,ymax,0, -yres)<br><br>from osgeo import gdal<br>from osgeo import gdal_array<br>
<br>src_ds=gdal_array.OpenArray(myarray)<br><br>dst_ds = gdal.GetDriverByName('GTiff').Create('E:/test/rasterise/mynewraster.tif',ncols, nrows, 1 ,gdal.GDT_Byte)<br>dst_rb = dst_ds.GetRasterBand(0)<br>dst_ds.SetGeoTransform(geotransform)<br>
output = gdal.RasterizeLayer(dst_ds)<br>