André,
>
> This code works for geotiff, but not for jpeg2000. There I'm getting the
> error: ERROR 6: GDALDriver::Create() ... no create method implemented
> for this format.
You cannot directly use Create() for any of the JPEG2000 drivers as Create()
assumes random writing capabilities which the JPEG2000 format doesn't offer. So
the solution is to create a temporary dataset (for example with the MEM driver
if it fits into RAM, or with an intermediate GeoTIFF otherwise) and then
CreateCopy() it to JPEG2000
Something like:
tmp_ds =
gdal.GetDriverByName('MEM').Create('',img.shape[0],img.shape[1],1,gdal.GDT_UInt16)
# here I
rb = tmp_ds.GetRasterBand(1)
rb.WriteArray(img)
dr.CreateCopy(fn, tmp_ds)
tmp_ds = None
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev