Giter VIP home page Giter VIP logo

plateaukit's Introduction

PlateauKit + PlateauLab

PyPI build Coverage Status PyPI downloads

Python library and utility for programming 3D city models by MLIT Project PLATEAU

PlateauKit は、国土交通省PLATEAUプロジェクトの3D都市モデルを利用するための変換ツールおよびPythonライブラリです。

PlateauLab は、JupyterLab / Jupyter Notebook上でPLATEAU都市モデルを扱うコーディング環境を実現するためのPythonライブラリです。 現在はPlateauKitの一部として提供しています。

機能 Features

  • PLATEAUデータセットのインストール・管理
  • GeoJSON / CityJSONへの変換
    • Java製の外部ライブラリ (citygml4j, citygml-tools) 非依存
    • 並列処理に対応 (変換速度の向上)
    • 圧縮ファイルのまま変換可能 (省容量)
  • JupyterLab / Jupyer Notebookでの3D都市モデル表示 (LOD1)
sample2-web.mp4

インストール Installation

pip install plateaukit

ロードマップ Roadmap

  • ドキュメントの整備
  • 最小限のテストの整備
  • ipydeck対応
  • JupyterLiteサポート
  • LOD2サポート (WIP)
  • 軽量版データセットの提供
  • 標高データの可視化
  • テストの拡充
  • CityJSON変換の高速化

その他のツール・ライブラリ Alternatives

Python

その他

クレジット Credits

ライセンス License

MIT License

PLATEAUデータセットの利用については、国土交通省 Project PLATEAU の利用規約に従ってください。

plateaukit's People

Contributors

ozekik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

plateaukit's Issues

都市モデルのprebuild時にGeoDataFrameのcrsプロパティへのアクセスでAttributeErrorとなる

東京都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.y

File /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でプレビルドするとエラー

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.