{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 39 Working with Shapely Base Geometries containing Z components\n", "\n", "Shapely Base Geometries can not only have an X and Y coordinate but also a Z component. The following introduces how GemGIS is handling Shapely Base Geometries with an additional Z component." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Set File Paths and download Tutorial Data\n", "\n", "If you downloaded the latest `GemGIS` version from the Github repository, append the path so that the package can be imported successfully. Otherwise, it is recommended to install `GemGIS` via `pip install gemgis` and import `GemGIS` using `import gemgis as gg`. In addition, the file path to the folder where the data is being stored is set. The tutorial data is downloaded using Pooch (https://www.fatiando.org/pooch/latest/index.html) and stored in the specified folder. Use `pip install pooch` if Pooch is not installed on your system yet." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-03-17T12:02:18.185292Z", "start_time": "2021-03-17T12:02:15.056570Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`\n", "C:\\Users\\ale93371\\Anaconda3\\envs\\test_gempy\\lib\\site-packages\\theano\\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory\n", " warnings.warn(\"DeprecationWarning: there is no c++ compiler.\"\n", "WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.\n", "WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.\n" ] } ], "source": [ "import gemgis as gg\n", "\n", "file_path ='data/39_shapely_base_geometries_with_z_component/'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Point Data\n", "\n", "Points can easily be defined using an X, Y and Z coordinate." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.855651Z", "start_time": "2021-01-04T09:42:38.098563Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`\n", "C:\\Users\\ale93371\\Anaconda3\\envs\\test_gempy\\lib\\site-packages\\theano\\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory\n", " warnings.warn(\"DeprecationWarning: there is no c++ compiler.\"\n", "WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.\n", "WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.\n" ] }, { "data": { "image/svg+xml": [ "" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import gemgis as gg\n", "from shapely.geometry import Point\n", "\n", "point = Point(1,2,3)\n", "point" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.871703Z", "start_time": "2021-01-04T09:42:40.857639Z" } }, "outputs": [ { "data": { "text/plain": [ "'POINT Z (1 2 3)'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "point.wkt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Despite the Z component, the point is still a regular Shapely Point." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.887713Z", "start_time": "2021-01-04T09:42:40.873698Z" } }, "outputs": [ { "data": { "text/plain": [ "shapely.geometry.point.Point" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(point)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "But the attribute that an object has a z component is now set to ``True``." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.903705Z", "start_time": "2021-01-04T09:42:40.889708Z" } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "point.has_z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Accessing the coordinates\n", "\n", "The coordinates can be accessed via attributes." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.919721Z", "start_time": "2021-01-04T09:42:40.904706Z" } }, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "point.x" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.935724Z", "start_time": "2021-01-04T09:42:40.925720Z" } }, "outputs": [ { "data": { "text/plain": [ "2.0" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "point.y" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.951723Z", "start_time": "2021-01-04T09:42:40.937705Z" } }, "outputs": [ { "data": { "text/plain": [ "3.0" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "point.z" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-01-03T11:58:58.043952Z", "start_time": "2021-01-03T11:58:58.034725Z" } }, "source": [ "### Creating a GeoDataFrame and extracting coordinates" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.967732Z", "start_time": "2021-01-04T09:42:40.953712Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometry
0POINT Z (1.00000 2.00000 3.00000)
1POINT Z (1.00000 2.00000 3.00000)
\n", "
" ], "text/plain": [ " geometry\n", "0 POINT Z (1.00000 2.00000 3.00000)\n", "1 POINT Z (1.00000 2.00000 3.00000)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import geopandas as gpd\n", "\n", "gdf = gpd.GeoDataFrame(geometry=[point, point])\n", "gdf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Extracting Coordinates" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.983722Z", "start_time": "2021-01-04T09:42:40.969716Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryXYZ
0POINT Z (1.00000 2.00000 3.00000)1.002.003.00
1POINT Z (1.00000 2.00000 3.00000)1.002.003.00
\n", "
" ], "text/plain": [ " geometry X Y Z\n", "0 POINT Z (1.00000 2.00000 3.00000) 1.00 2.00 3.00\n", "1 POINT Z (1.00000 2.00000 3.00000) 1.00 2.00 3.00" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xyz_points(gdf=gdf)\n", "gdf_xyz" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:40.999721Z", "start_time": "2021-01-04T09:42:40.985723Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryXYZ
0POINT Z (1.00000 2.00000 3.00000)1.002.003.00
1POINT Z (1.00000 2.00000 3.00000)1.002.003.00
\n", "
" ], "text/plain": [ " geometry X Y Z\n", "0 POINT Z (1.00000 2.00000 3.00000) 1.00 2.00 3.00\n", "1 POINT Z (1.00000 2.00000 3.00000) 1.00 2.00 3.00" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xyz(gdf=gdf)\n", "gdf_xyz" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## LineString Data" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.014724Z", "start_time": "2021-01-04T09:42:41.001720Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import gemgis as gg\n", "from shapely.geometry import LineString\n", "\n", "linestring = LineString(([1,2,3], [4,5,6]))\n", "linestring" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.029727Z", "start_time": "2021-01-04T09:42:41.016725Z" } }, "outputs": [ { "data": { "text/plain": [ "'LINESTRING Z (1 2 3, 4 5 6)'" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "linestring.wkt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Despite the Z component, the line is still a regular Shapely LineString." ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.045731Z", "start_time": "2021-01-04T09:42:41.031730Z" } }, "outputs": [ { "data": { "text/plain": [ "shapely.geometry.linestring.LineString" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(linestring)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "But the attribute that an object has a z component is now set to ``True``." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.061157Z", "start_time": "2021-01-04T09:42:41.047732Z" } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "linestring.has_z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Accessing the coordinates\n", "\n", "The coordinates can be accessed via attributes." ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.077161Z", "start_time": "2021-01-04T09:42:41.063152Z" } }, "outputs": [ { "data": { "text/plain": [ "[(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)]" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list(linestring.coords)" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-01-03T11:58:58.043952Z", "start_time": "2021-01-03T11:58:58.034725Z" } }, "source": [ "### Creating a GeoDataFrame and extracting coordinates" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.093157Z", "start_time": "2021-01-04T09:42:41.078154Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometry
0LINESTRING Z (1.00000 2.00000 3.00000, 4.00000...
1LINESTRING Z (1.00000 2.00000 3.00000, 4.00000...
\n", "
" ], "text/plain": [ " geometry\n", "0 LINESTRING Z (1.00000 2.00000 3.00000, 4.00000...\n", "1 LINESTRING Z (1.00000 2.00000 3.00000, 4.00000..." ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import geopandas as gpd\n", "\n", "gdf = gpd.GeoDataFrame(geometry=[linestring, linestring])\n", "gdf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Extracting Coordinates\n", "\n", "``extract_xy_linestrings(..)`` will also work for extracting the xyz coordinates as the used Pandas ``explode(..)`` function also extracts the Z component of the LineString object. In the subsequent definition of the columns for the coordinates, an additional Z column will be created if a Value error would have been returned before that. " ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.125184Z", "start_time": "2021-01-04T09:42:41.096160Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryXYZ
0POINT (1.00000 2.00000)1.002.003.00
1POINT (4.00000 5.00000)4.005.006.00
2POINT (1.00000 2.00000)1.002.003.00
3POINT (4.00000 5.00000)4.005.006.00
\n", "
" ], "text/plain": [ " geometry X Y Z\n", "0 POINT (1.00000 2.00000) 1.00 2.00 3.00\n", "1 POINT (4.00000 5.00000) 4.00 5.00 6.00\n", "2 POINT (1.00000 2.00000) 1.00 2.00 3.00\n", "3 POINT (4.00000 5.00000) 4.00 5.00 6.00" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xy_linestrings(gdf=gdf)\n", "gdf_xyz" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "However, a dedicated function to extract the X, Y and Z coordinates from a GeoDataFrame containing LineStrings with a Z component is also implemented in GemGIS -> ``extract_xyz_linestrings(...)``." ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.157171Z", "start_time": "2021-01-04T09:42:41.128166Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometrypointsXYZ
0POINT (1.00000 2.00000)(1.0, 2.0, 3.0)1.002.003.00
1POINT (4.00000 5.00000)(4.0, 5.0, 6.0)4.005.006.00
2POINT (1.00000 2.00000)(1.0, 2.0, 3.0)1.002.003.00
3POINT (4.00000 5.00000)(4.0, 5.0, 6.0)4.005.006.00
\n", "
" ], "text/plain": [ " geometry points X Y Z\n", "0 POINT (1.00000 2.00000) (1.0, 2.0, 3.0) 1.00 2.00 3.00\n", "1 POINT (4.00000 5.00000) (4.0, 5.0, 6.0) 4.00 5.00 6.00\n", "2 POINT (1.00000 2.00000) (1.0, 2.0, 3.0) 1.00 2.00 3.00\n", "3 POINT (4.00000 5.00000) (4.0, 5.0, 6.0) 4.00 5.00 6.00" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xyz_linestrings(gdf=gdf, reset_index=True)\n", "gdf_xyz" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The coordinates can also be extracted using the common function ``extract_xyz(...)``." ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.188186Z", "start_time": "2021-01-04T09:42:41.159173Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryXYZ
0POINT (1.00000 2.00000)1.002.003.00
1POINT (4.00000 5.00000)4.005.006.00
2POINT (1.00000 2.00000)1.002.003.00
3POINT (4.00000 5.00000)4.005.006.00
\n", "
" ], "text/plain": [ " geometry X Y Z\n", "0 POINT (1.00000 2.00000) 1.00 2.00 3.00\n", "1 POINT (4.00000 5.00000) 4.00 5.00 6.00\n", "2 POINT (1.00000 2.00000) 1.00 2.00 3.00\n", "3 POINT (4.00000 5.00000) 4.00 5.00 6.00" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xyz(gdf=gdf)\n", "gdf_xyz" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Polygon Data" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.204195Z", "start_time": "2021-01-04T09:42:41.192180Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "" ], "text/plain": [ "" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import gemgis as gg\n", "from shapely.geometry import Polygon\n", "\n", "polygon = Polygon([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]])\n", "polygon" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.220186Z", "start_time": "2021-01-04T09:42:41.207183Z" } }, "outputs": [ { "data": { "text/plain": [ "'POLYGON Z ((0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 0 0))'" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "polygon.wkt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Despite the Z component, the line is still a regular Shapely Polygon." ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.236189Z", "start_time": "2021-01-04T09:42:41.222189Z" } }, "outputs": [ { "data": { "text/plain": [ "shapely.geometry.polygon.Polygon" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(polygon)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "But the attribute that an object has a z component is now set to ``True``." ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.252192Z", "start_time": "2021-01-04T09:42:41.238191Z" } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "polygon.has_z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Accessing the coordinates\n", "\n", "The coordinates can be accessed via attributes." ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.267197Z", "start_time": "2021-01-04T09:42:41.254197Z" } }, "outputs": [ { "data": { "text/plain": [ "[(0.0, 0.0, 0.0),\n", " (1.0, 0.0, 0.0),\n", " (1.0, 1.0, 0.0),\n", " (0.0, 1.0, 0.0),\n", " (0.0, 0.0, 0.0)]" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list(polygon.exterior.coords)" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-01-03T11:58:58.043952Z", "start_time": "2021-01-03T11:58:58.034725Z" } }, "source": [ "### Creating a GeoDataFrame and extracting coordinates" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.283200Z", "start_time": "2021-01-04T09:42:41.268199Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometry
0POLYGON Z ((0.00000 0.00000 0.00000, 1.00000 0...
1POLYGON Z ((0.00000 0.00000 0.00000, 1.00000 0...
\n", "
" ], "text/plain": [ " geometry\n", "0 POLYGON Z ((0.00000 0.00000 0.00000, 1.00000 0...\n", "1 POLYGON Z ((0.00000 0.00000 0.00000, 1.00000 0..." ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import geopandas as gpd\n", "\n", "gdf = gpd.GeoDataFrame(geometry=[polygon, polygon])\n", "gdf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Extracting Coordinates\n", "\n", "The coordinates can be extracted easily with ``extract_xyz(...)``. As the polygons are exploded into LineStrings during the process of extracting the coordinates, the functionality to extract coordinates from Polygons is already present. " ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "ExecuteTime": { "end_time": "2021-01-04T09:42:41.315207Z", "start_time": "2021-01-04T09:42:41.286204Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryXYZ
0POINT (0.00000 0.00000)0.000.000.00
1POINT (1.00000 0.00000)1.000.000.00
2POINT (1.00000 1.00000)1.001.000.00
3POINT (0.00000 1.00000)0.001.000.00
4POINT (0.00000 0.00000)0.000.000.00
5POINT (0.00000 0.00000)0.000.000.00
6POINT (1.00000 0.00000)1.000.000.00
7POINT (1.00000 1.00000)1.001.000.00
8POINT (0.00000 1.00000)0.001.000.00
9POINT (0.00000 0.00000)0.000.000.00
\n", "
" ], "text/plain": [ " geometry X Y Z\n", "0 POINT (0.00000 0.00000) 0.00 0.00 0.00\n", "1 POINT (1.00000 0.00000) 1.00 0.00 0.00\n", "2 POINT (1.00000 1.00000) 1.00 1.00 0.00\n", "3 POINT (0.00000 1.00000) 0.00 1.00 0.00\n", "4 POINT (0.00000 0.00000) 0.00 0.00 0.00\n", "5 POINT (0.00000 0.00000) 0.00 0.00 0.00\n", "6 POINT (1.00000 0.00000) 1.00 0.00 0.00\n", "7 POINT (1.00000 1.00000) 1.00 1.00 0.00\n", "8 POINT (0.00000 1.00000) 0.00 1.00 0.00\n", "9 POINT (0.00000 0.00000) 0.00 0.00 0.00" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gdf_xyz = gg.vector.extract_xyz(gdf=gdf)\n", "gdf_xyz" ] } ], "metadata": { "hide_input": false, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }