Get Height (Z) Values from DSM¶
This part introduces the parameters and controls to get height (or z) values for ROI from Digital Surface Model (DSM) GeoTiff.

To be continued
keep_crs and warnings
We can notice, the roi x and y values also changed. Because the ROI shp geo-coord is EPSG::4326 while the DSM is EPSG::32654
if you want keep the x and y value, you can:
>>> roi.get_z_from_dsm(lotus.metashape.dsm, keep_crs=True)
>>> roi[0]
array([[139.54052962, 35.73475194, 97.39808655],
[139.54055106, 35.73475596, 97.39808655],
[139.54055592, 35.73473843, 97.39808655],
[139.54053438, 35.73473446, 97.39808655],
[139.54052962, 35.73475194, 97.39808655]])
But it is highly recommended to use the same CRS with the DOM/DSM, otherwise will raise ValueErrors in the later use.
File d:\onedrive\program\github\easyidp\easyidp\geotiff.py:159, in GeoTiff.crop(self, roi, is_geo, save_folder)
156 else:
157 save_path = None
--> 159 imarray = self.crop_polygon(polygon_hv, is_geo, save_path)
161 out_dict[k] = imarray
163 return out_dict
File d:\onedrive\program\github\easyidp\easyidp\geotiff.py:212, in GeoTiff.crop_polygon(self, polygon_hv, is_geo, save_path)
210 with tf.TiffFile(self.file_path) as tif:
211 page = tif.pages[0]
...
--> 815 raise ValueError("h and w must be strictly positive.")
817 i1, j1 = i0 + h, j0 + w
818 if i0 < 0 or j0 < 0 or i1 >= im_height or j1 >= im_width:
ValueError: h and w must be strictly positive.