{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "8f8408e6", "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd" ] }, { "cell_type": "code", "execution_count": 2, "id": "d8461792", "metadata": {}, "outputs": [], "source": [ "import shapely" ] }, { "cell_type": "code", "execution_count": 3, "id": "6bbb8081", "metadata": {}, "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", " \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", "
BezeichnunBaumartBaumhöheKronenbreiStammumfanDurchmesseBreitengraLängengrageometry
0Tilia CordataLinde15.75.31.60.09.92902049.786065POINT (4350885.205 5518545.260)
1Tilia CordataLinde13.34.91.00.09.93428649.794348POINT (4351289.754 5519455.869)
2robinia pseudoacaciaRobinie17.74.51.70.09.94256849.795610POINT (4351889.764 5519579.827)
3Tilia CordataLinde15.25.01.10.09.94198849.794548POINT (4351844.785 5519462.881)
4robinia pseudoacaciaRobinie12.84.21.10.09.94886549.787736POINT (4352319.118 5518691.817)
5Tilia CordataLinde13.84.01.30.09.95008349.787398POINT (4352405.769 5518651.799)
6Tilia CordataLinde14.83.40.90.09.96425049.791921POINT (4353439.338 5519127.002)
7robinia pseudoacaciaRobinie11.74.31.20.09.96250649.792440POINT (4353315.381 5519188.121)
\n", "
" ], "text/plain": [ " Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \\\n", "0 Tilia Cordata Linde 15.7 5.3 1.6 \n", "1 Tilia Cordata Linde 13.3 4.9 1.0 \n", "2 robinia pseudoacacia Robinie 17.7 4.5 1.7 \n", "3 Tilia Cordata Linde 15.2 5.0 1.1 \n", "4 robinia pseudoacacia Robinie 12.8 4.2 1.1 \n", "5 Tilia Cordata Linde 13.8 4.0 1.3 \n", "6 Tilia Cordata Linde 14.8 3.4 0.9 \n", "7 robinia pseudoacacia Robinie 11.7 4.3 1.2 \n", "\n", " Durchmesse Breitengra Längengra geometry \n", "0 0.0 9.929020 49.786065 POINT (4350885.205 5518545.260) \n", "1 0.0 9.934286 49.794348 POINT (4351289.754 5519455.869) \n", "2 0.0 9.942568 49.795610 POINT (4351889.764 5519579.827) \n", "3 0.0 9.941988 49.794548 POINT (4351844.785 5519462.881) \n", "4 0.0 9.948865 49.787736 POINT (4352319.118 5518691.817) \n", "5 0.0 9.950083 49.787398 POINT (4352405.769 5518651.799) \n", "6 0.0 9.964250 49.791921 POINT (4353439.338 5519127.002) \n", "7 0.0 9.962506 49.792440 POINT (4353315.381 5519188.121) " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = gpd.read_file('Klimabäume_SImStadtUTm.shp')\n", "df" ] }, { "cell_type": "code", "execution_count": 4, "id": "e0ceeefa", "metadata": {}, "outputs": [], "source": [ "df = df.to_crs(25832)" ] }, { "cell_type": "code", "execution_count": 5, "id": "208df86b", "metadata": {}, "outputs": [], "source": [ "df = df.drop(columns=['Breitengra', 'Längengra'])" ] }, { "cell_type": "code", "execution_count": 6, "id": "d72ccb64", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\n", "Name: ETRS89 / UTM zone 32N\n", "Axis Info [cartesian]:\n", "- E[east]: Easting (metre)\n", "- N[north]: Northing (metre)\n", "Area of Use:\n", "- name: Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore.\n", "- bounds: (6.0, 38.76, 12.01, 84.33)\n", "Coordinate Operation:\n", "- name: UTM zone 32N\n", "- method: Transverse Mercator\n", "Datum: European Terrestrial Reference System 1989 ensemble\n", "- Ellipsoid: GRS 1980\n", "- Prime Meridian: Greenwich" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.crs" ] }, { "cell_type": "code", "execution_count": 7, "id": "8fbe258a", "metadata": {}, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BezeichnunBaumartBaumhöheKronenbreiStammumfanDurchmessegeometry
0Tilia CordataLinde15.75.31.60.0POINT (566791.332 5515133.591)
1Tilia CordataLinde13.34.91.00.0POINT (567158.925 5516059.074)
2robinia pseudoacaciaRobinie17.74.51.70.0POINT (567753.134 5516206.830)
3Tilia CordataLinde15.25.01.10.0POINT (567712.891 5516088.252)
4robinia pseudoacaciaRobinie12.84.21.10.0POINT (568217.362 5515337.228)
5Tilia CordataLinde13.84.01.30.0POINT (568305.490 5515300.728)
6Tilia CordataLinde14.83.40.90.0POINT (569318.620 5515816.558)
7robinia pseudoacaciaRobinie11.74.31.20.0POINT (569192.394 5515872.638)
\n", "
" ], "text/plain": [ " Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \\\n", "0 Tilia Cordata Linde 15.7 5.3 1.6 \n", "1 Tilia Cordata Linde 13.3 4.9 1.0 \n", "2 robinia pseudoacacia Robinie 17.7 4.5 1.7 \n", "3 Tilia Cordata Linde 15.2 5.0 1.1 \n", "4 robinia pseudoacacia Robinie 12.8 4.2 1.1 \n", "5 Tilia Cordata Linde 13.8 4.0 1.3 \n", "6 Tilia Cordata Linde 14.8 3.4 0.9 \n", "7 robinia pseudoacacia Robinie 11.7 4.3 1.2 \n", "\n", " Durchmesse geometry \n", "0 0.0 POINT (566791.332 5515133.591) \n", "1 0.0 POINT (567158.925 5516059.074) \n", "2 0.0 POINT (567753.134 5516206.830) \n", "3 0.0 POINT (567712.891 5516088.252) \n", "4 0.0 POINT (568217.362 5515337.228) \n", "5 0.0 POINT (568305.490 5515300.728) \n", "6 0.0 POINT (569318.620 5515816.558) \n", "7 0.0 POINT (569192.394 5515872.638) " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 8, "id": "38000721", "metadata": {}, "outputs": [], "source": [ "df.to_file(\"Klimabäume_SImStadt.shp\", encoding='utf-8')" ] }, { "cell_type": "code", "execution_count": 9, "id": "40cad6d4", "metadata": {}, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
BezeichnunBaumartBaumhöheKronenbreiStammumfanDurchmessegeometry
0Tilia CordataLinde15.75.31.60.0POINT (566791.332 5515133.591)
1Tilia CordataLinde13.34.91.00.0POINT (567158.925 5516059.074)
2robinia pseudoacaciaRobinie17.74.51.70.0POINT (567753.134 5516206.830)
3Tilia CordataLinde15.25.01.10.0POINT (567712.891 5516088.252)
4robinia pseudoacaciaRobinie12.84.21.10.0POINT (568217.362 5515337.228)
5Tilia CordataLinde13.84.01.30.0POINT (568305.490 5515300.728)
6Tilia CordataLinde14.83.40.90.0POINT (569318.620 5515816.558)
7robinia pseudoacaciaRobinie11.74.31.20.0POINT (569192.394 5515872.638)
\n", "
" ], "text/plain": [ " Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \\\n", "0 Tilia Cordata Linde 15.7 5.3 1.6 \n", "1 Tilia Cordata Linde 13.3 4.9 1.0 \n", "2 robinia pseudoacacia Robinie 17.7 4.5 1.7 \n", "3 Tilia Cordata Linde 15.2 5.0 1.1 \n", "4 robinia pseudoacacia Robinie 12.8 4.2 1.1 \n", "5 Tilia Cordata Linde 13.8 4.0 1.3 \n", "6 Tilia Cordata Linde 14.8 3.4 0.9 \n", "7 robinia pseudoacacia Robinie 11.7 4.3 1.2 \n", "\n", " Durchmesse geometry \n", "0 0.0 POINT (566791.332 5515133.591) \n", "1 0.0 POINT (567158.925 5516059.074) \n", "2 0.0 POINT (567753.134 5516206.830) \n", "3 0.0 POINT (567712.891 5516088.252) \n", "4 0.0 POINT (568217.362 5515337.228) \n", "5 0.0 POINT (568305.490 5515300.728) \n", "6 0.0 POINT (569318.620 5515816.558) \n", "7 0.0 POINT (569192.394 5515872.638) " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = gpd.read_file('Klimabäume_SImStadt.shp')\n", "df" ] }, { "cell_type": "code", "execution_count": 10, "id": "b5df1e3f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Bezeichnun',\n", " 'Baumart',\n", " 'Baumhöhe',\n", " 'Kronenbrei',\n", " 'Stammumfan',\n", " 'Durchmesse',\n", " 'geometry']" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list(df)" ] }, { "cell_type": "code", "execution_count": 11, "id": "c26ecc76", "metadata": {}, "outputs": [], "source": [ "poly = df.geometry[0]" ] }, { "cell_type": "code", "execution_count": 12, "id": "43d36ff6", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "poly" ] }, { "cell_type": "code", "execution_count": 13, "id": "67377424", "metadata": {}, "outputs": [], "source": [ "poly2d = shapely.ops.transform(lambda *args: args[:2], poly)" ] }, { "cell_type": "code", "execution_count": 14, "id": "9bab724b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'POINT (566791.3315698793 5515133.590795662)'" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "poly2d.wkt" ] }, { "cell_type": "code", "execution_count": null, "id": "29537f36", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }