easyidp.geotiff.save_geotiff#

easyidp.geotiff.save_geotiff(header, imarray, left_top_corner, save_path)#

Save cropped region to geotiff file

Parameters:
  • header (dict) – the geotiff head dictionary from get_header()

  • imarray (ndarray) – (m, n, d) image ndarray cropped from crop_polygon

  • left_top_corner (ndarray) –

    the pixel position of image top left cornder,
    the order is (left, top)

  • save_path (str) – the save to geotiff file path

Example

Prepare data:

>>> import easyidp as idp
>>> test_data = idp.data.TestData()

>>> dom = idp.GeoTiff(test_data.tiff.soyweed_part)
>>> dom_imarray = idp.geotiff.get_imarray(test_data.tiff.soyweed_part)

If want to move each 20 pixels of this geotiff to right and bottom

>>> left_top_corner = [200, 200]    # add 20 and 20 offsets
>>> save_tiff = "path/to/save/output.tif"
>>> idp.geotiff.save_geotiff(dom_test.header, dom_imarray, left_top_corner, save_tiff)

Then using the QGIS to compare between input and output:

save_geotiff_offset.png