ozekik / plateaukit Goto Github PK
View Code? Open in Web Editor NEWPython library and utility for PLATEAU datasets by MLIT Japan
Home Page: https://ozekik.github.io/plateaukit/
License: MIT License
Python library and utility for PLATEAU datasets by MLIT Japan
Home Page: https://ozekik.github.io/plateaukit/
License: MIT License
東京都23区データ(plateau-tokyo23ku-2022)のインストール時にエラーとなります。すべての都市モデルを調べたわけではありませんが、東村山市(plateau-13213-higashimurayama-shi-2020)、川崎市(plateau-14130-kawasaki-shi-2022)、横浜市(plateau-14100-yokohama-shi-2022)では出ていません。
データのダウンロードはうまくいっているようです。そこでローカルのデータに対してprebuildしてみました。
from plateaukit.prebuild import prebuild
dataset_id = "plateau-tokyo23ku-2022"
prebuild(dataset_id, split=1, simple_output=False)
すると、下記のエラーが発生します。
AttributeError Traceback (most recent call last)
Cell In[32], line 3
1 from plateaukit.prebuild import prebuild
2 dataset_id = "plateau-tokyo23ku-2022"
----> 3 prebuild(dataset_id, split=1, simple_output=False)File /opt/conda/lib/python3.11/site-packages/plateaukit/prebuild.py:64, in prebuild(dataset_id, split, simple_output)
61 df = pd.concat([df, subdf])
63 # TODO: Use more accurate CRS
---> 64 centroid = df.to_crs(3857).centroid.to_crs(4326)
66 df["longitude"] = centroid.x
67 df["latitude"] = centroid.yFile /opt/conda/lib/python3.11/site-packages/geopandas/geodataframe.py:1407, in GeoDataFrame.to_crs(self, crs, epsg, inplace)
1405 else:
1406 df = self.copy()
-> 1407 geom = df.geometry.to_crs(crs=crs, epsg=epsg)
1408 df.geometry = geom
1409 if not inplace:File /opt/conda/lib/python3.11/site-packages/pandas/core/generic.py:6204, in NDFrame.getattr(self, name)
6197 if (
6198 name not in self._internal_names_set
6199 and name not in self._metadata
6200 and name not in self._accessors
6201 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6202 ):
6203 return self[name]
-> 6204 return object.getattribute(self, name)File /opt/conda/lib/python3.11/site-packages/geopandas/geodataframe.py:236, in GeoDataFrame._get_geometry(self)
229 else:
230 msg += (
231 "\nThere are no existing columns with geometry data type. You can "
232 "add a geometry column as the active geometry column with "
233 "df.set_geometry. "
234 )
--> 236 raise AttributeError(msg)
237 return self[self._geometry_column_name]AttributeError: You are calling a geospatial method on the GeoDataFrame, but the active geometry column to use has not been set.
There are no existing columns with geometry data type. You can add a geometry column as the active geometry column with df.set_geometry.
これは、GeoPandas v0.12で変更された下記が影響しているようです。
Accessing the crs of a GeoDataFrame without active geometry column was deprecated and this now raises an AttributeError (#2578).
こちらの実行環境です。
Ubuntu 22.04.3 LTS
Python 3.11.6
pip 24.0
jupyterlab 4.0.7
geopandas 0.14.3
Windows10 Python 3.10.11の環境で,コマンドラインでデータをプレビルドすると下記のエラーとなります.
AttributeError: You are calling a geospatial method on the GeoDataFrame, but the active geometry column to use has not been set.
There are no existing columns with geometry data type. You can add a geometry column as the active geometry column with df.set_geometry.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.