{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Get Height (Z) Values from DSM\n", "\n", "This part introduces the parameters and controls to get height (or z) values for ROI from Digital Surface Model (DSM) GeoTiff.\n", "\n", "
\"lotus
" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "To be continued" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "keep_crs and warnings" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "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\n", "\n", "if you want keep the x and y value, you can:\n", "\n", "```python\n", ">>> roi.get_z_from_dsm(lotus.metashape.dsm, keep_crs=True)\n", ">>> roi[0]\n", "array([[139.54052962, 35.73475194, 97.39808655],\n", " [139.54055106, 35.73475596, 97.39808655],\n", " [139.54055592, 35.73473843, 97.39808655],\n", " [139.54053438, 35.73473446, 97.39808655],\n", " [139.54052962, 35.73475194, 97.39808655]])\n", "```\n", "\n", "But it is highly recommended to use the same CRS with the DOM/DSM, otherwise will raise ValueErrors in the later use.\n", "\n", "```python\n", "File d:\\onedrive\\program\\github\\easyidp\\easyidp\\geotiff.py:159, in GeoTiff.crop(self, roi, is_geo, save_folder)\n", " 156 else:\n", " 157 save_path = None\n", "--> 159 imarray = self.crop_polygon(polygon_hv, is_geo, save_path)\n", " 161 out_dict[k] = imarray\n", " 163 return out_dict\n", "\n", "File d:\\onedrive\\program\\github\\easyidp\\easyidp\\geotiff.py:212, in GeoTiff.crop_polygon(self, polygon_hv, is_geo, save_path)\n", " 210 with tf.TiffFile(self.file_path) as tif:\n", " 211 page = tif.pages[0]\n", "...\n", "--> 815 raise ValueError(\"h and w must be strictly positive.\")\n", " 817 i1, j1 = i0 + h, j0 + w\n", " 818 if i0 < 0 or j0 < 0 or i1 >= im_height or j1 >= im_width:\n", "\n", "ValueError: h and w must be strictly positive.\n", "```" ] }, { "cell_type": "raw", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "easyidp", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.8.13 (default, Mar 28 2022, 06:16:26) \n[Clang 12.0.0 ]" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "c57a372376ecab0caeb8816769a3e0fc257b5754cdacff7b12180918199af449" } } }, "nbformat": 4, "nbformat_minor": 2 }