Commit 3539d249 authored by Eric Duminil's avatar Eric Duminil
Browse files

Keep UTF8 encoding

parent 35d003e9
%% Cell type:code id:8f8408e6 tags: %% Cell type:code id:8f8408e6 tags:
``` python ``` python
import geopandas as gpd import geopandas as gpd
``` ```
%% Cell type:code id:d8461792 tags: %% Cell type:code id:d8461792 tags:
``` python ``` python
import shapely import shapely
``` ```
%% Cell type:code id:6bbb8081 tags: %% Cell type:code id:6bbb8081 tags:
``` python ``` python
df = gpd.read_file('Klimabäume_SImStadtUTm.shp') df = gpd.read_file('Klimabäume_SImStadtUTm.shp')
df df
``` ```
%% Output %% Output
Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \ Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \
0 Tilia Cordata Linde 15.7 5.3 1.6 0 Tilia Cordata Linde 15.7 5.3 1.6
1 Tilia Cordata Linde 13.3 4.9 1.0 1 Tilia Cordata Linde 13.3 4.9 1.0
2 robinia pseudoacacia Robinie 17.7 4.5 1.7 2 robinia pseudoacacia Robinie 17.7 4.5 1.7
3 Tilia Cordata Linde 15.2 5.0 1.1 3 Tilia Cordata Linde 15.2 5.0 1.1
4 robinia pseudoacacia Robinie 12.8 4.2 1.1 4 robinia pseudoacacia Robinie 12.8 4.2 1.1
5 Tilia Cordata Linde 13.8 4.0 1.3 5 Tilia Cordata Linde 13.8 4.0 1.3
6 Tilia Cordata Linde 14.8 3.4 0.9 6 Tilia Cordata Linde 14.8 3.4 0.9
7 robinia pseudoacacia Robinie 11.7 4.3 1.2 7 robinia pseudoacacia Robinie 11.7 4.3 1.2
Durchmesse Breitengra Längengra geometry Durchmesse Breitengra Längengra geometry
0 0.0 9.929020 49.786065 POINT (4350885.205 5518545.260) 0 0.0 9.929020 49.786065 POINT (4350885.205 5518545.260)
1 0.0 9.934286 49.794348 POINT (4351289.754 5519455.869) 1 0.0 9.934286 49.794348 POINT (4351289.754 5519455.869)
2 0.0 9.942568 49.795610 POINT (4351889.764 5519579.827) 2 0.0 9.942568 49.795610 POINT (4351889.764 5519579.827)
3 0.0 9.941988 49.794548 POINT (4351844.785 5519462.881) 3 0.0 9.941988 49.794548 POINT (4351844.785 5519462.881)
4 0.0 9.948865 49.787736 POINT (4352319.118 5518691.817) 4 0.0 9.948865 49.787736 POINT (4352319.118 5518691.817)
5 0.0 9.950083 49.787398 POINT (4352405.769 5518651.799) 5 0.0 9.950083 49.787398 POINT (4352405.769 5518651.799)
6 0.0 9.964250 49.791921 POINT (4353439.338 5519127.002) 6 0.0 9.964250 49.791921 POINT (4353439.338 5519127.002)
7 0.0 9.962506 49.792440 POINT (4353315.381 5519188.121) 7 0.0 9.962506 49.792440 POINT (4353315.381 5519188.121)
%% Cell type:code id:e0ceeefa tags: %% Cell type:code id:e0ceeefa tags:
``` python ``` python
df = df.to_crs(25832) df = df.to_crs(25832)
``` ```
%% Cell type:code id:208df86b tags: %% Cell type:code id:208df86b tags:
``` python ``` python
df = df.drop(columns=['Breitengra', 'Längengra']) df = df.drop(columns=['Breitengra', 'Längengra'])
``` ```
%% Cell type:code id:d72ccb64 tags: %% Cell type:code id:d72ccb64 tags:
``` python ``` python
df.crs df.crs
``` ```
%% Output %% Output
<Projected CRS: EPSG:25832> <Projected CRS: EPSG:25832>
Name: ETRS89 / UTM zone 32N Name: ETRS89 / UTM zone 32N
Axis Info [cartesian]: Axis Info [cartesian]:
- E[east]: Easting (metre) - E[east]: Easting (metre)
- N[north]: Northing (metre) - N[north]: Northing (metre)
Area of Use: Area of Use:
- 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. - 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.
- bounds: (6.0, 38.76, 12.01, 84.33) - bounds: (6.0, 38.76, 12.01, 84.33)
Coordinate Operation: Coordinate Operation:
- name: UTM zone 32N - name: UTM zone 32N
- method: Transverse Mercator - method: Transverse Mercator
Datum: European Terrestrial Reference System 1989 ensemble Datum: European Terrestrial Reference System 1989 ensemble
- Ellipsoid: GRS 1980 - Ellipsoid: GRS 1980
- Prime Meridian: Greenwich - Prime Meridian: Greenwich
%% Cell type:code id:8fbe258a tags: %% Cell type:code id:8fbe258a tags:
``` python ``` python
df df
``` ```
%% Output %% Output
Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \ Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \
0 Tilia Cordata Linde 15.7 5.3 1.6 0 Tilia Cordata Linde 15.7 5.3 1.6
1 Tilia Cordata Linde 13.3 4.9 1.0 1 Tilia Cordata Linde 13.3 4.9 1.0
2 robinia pseudoacacia Robinie 17.7 4.5 1.7 2 robinia pseudoacacia Robinie 17.7 4.5 1.7
3 Tilia Cordata Linde 15.2 5.0 1.1 3 Tilia Cordata Linde 15.2 5.0 1.1
4 robinia pseudoacacia Robinie 12.8 4.2 1.1 4 robinia pseudoacacia Robinie 12.8 4.2 1.1
5 Tilia Cordata Linde 13.8 4.0 1.3 5 Tilia Cordata Linde 13.8 4.0 1.3
6 Tilia Cordata Linde 14.8 3.4 0.9 6 Tilia Cordata Linde 14.8 3.4 0.9
7 robinia pseudoacacia Robinie 11.7 4.3 1.2 7 robinia pseudoacacia Robinie 11.7 4.3 1.2
Durchmesse geometry Durchmesse geometry
0 0.0 POINT (566791.332 5515133.591) 0 0.0 POINT (566791.332 5515133.591)
1 0.0 POINT (567158.925 5516059.074) 1 0.0 POINT (567158.925 5516059.074)
2 0.0 POINT (567753.134 5516206.830) 2 0.0 POINT (567753.134 5516206.830)
3 0.0 POINT (567712.891 5516088.252) 3 0.0 POINT (567712.891 5516088.252)
4 0.0 POINT (568217.362 5515337.228) 4 0.0 POINT (568217.362 5515337.228)
5 0.0 POINT (568305.490 5515300.728) 5 0.0 POINT (568305.490 5515300.728)
6 0.0 POINT (569318.620 5515816.558) 6 0.0 POINT (569318.620 5515816.558)
7 0.0 POINT (569192.394 5515872.638) 7 0.0 POINT (569192.394 5515872.638)
%% Cell type:code id:38000721 tags: %% Cell type:code id:38000721 tags:
``` python ``` python
df.to_file("Klimabäume_SImStadt.shp") df.to_file("Klimabäume_SImStadt.shp", encoding='utf-8')
``` ```
%% Cell type:code id:40cad6d4 tags:
``` python
df = gpd.read_file('Klimabäume_SImStadt.shp')
df
```
%% Output
Bezeichnun Baumart Baumhöhe Kronenbrei Stammumfan \
0 Tilia Cordata Linde 15.7 5.3 1.6
1 Tilia Cordata Linde 13.3 4.9 1.0
2 robinia pseudoacacia Robinie 17.7 4.5 1.7
3 Tilia Cordata Linde 15.2 5.0 1.1
4 robinia pseudoacacia Robinie 12.8 4.2 1.1
5 Tilia Cordata Linde 13.8 4.0 1.3
6 Tilia Cordata Linde 14.8 3.4 0.9
7 robinia pseudoacacia Robinie 11.7 4.3 1.2
Durchmesse geometry
0 0.0 POINT (566791.332 5515133.591)
1 0.0 POINT (567158.925 5516059.074)
2 0.0 POINT (567753.134 5516206.830)
3 0.0 POINT (567712.891 5516088.252)
4 0.0 POINT (568217.362 5515337.228)
5 0.0 POINT (568305.490 5515300.728)
6 0.0 POINT (569318.620 5515816.558)
7 0.0 POINT (569192.394 5515872.638)
%% Cell type:code id:b5df1e3f tags:
``` python
list(df)
```
%% Output
['Bezeichnun',
'Baumart',
'Baumhöhe',
'Kronenbrei',
'Stammumfan',
'Durchmesse',
'geometry']
%% Cell type:code id:c26ecc76 tags: %% Cell type:code id:c26ecc76 tags:
``` python ``` python
poly = df.geometry[0] poly = df.geometry[0]
``` ```
%% Cell type:code id:43d36ff6 tags: %% Cell type:code id:43d36ff6 tags:
``` python ``` python
poly poly
``` ```
%% Output %% Output
<POINT (566791.332 5515133.591)> <POINT (566791.332 5515133.591)>
%% Cell type:code id:67377424 tags: %% Cell type:code id:67377424 tags:
``` python ``` python
poly2d = shapely.ops.transform(lambda *args: args[:2], poly) poly2d = shapely.ops.transform(lambda *args: args[:2], poly)
``` ```
%% Cell type:code id:9bab724b tags: %% Cell type:code id:9bab724b tags:
``` python ``` python
poly2d.wkt poly2d.wkt
``` ```
%% Output %% Output
'POINT (566791.3315698793 5515133.590795662)' 'POINT (566791.3315698793 5515133.590795662)'
%% Cell type:code id:29537f36 tags: %% Cell type:code id:29537f36 tags:
``` python ``` python
``` ```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment