MIERUNE / plateau-gis-converter

A proof of concept GUI and CLI tool for converting PLATEAU's 3D city models (CityGML) of Japan into various geospatial formats, including 3D Tiles, MVT, and GeoPackage.
https://mierune.github.io/plateau-gis-converter/
MIT License
51 stars 10 forks source link

地下埋設物を対象とした平面直角座標系への対応 #640

Closed TadaTeruki closed 2 weeks ago

TadaTeruki commented 3 weeks ago

Close #500

What I did(変更内容)

https://www.mlit.go.jp/plateaudocument/#toc9_06

PLATEAUのCityGMLデータにおいて、地下埋設物のジオメトリは「日本測地系2011における平面直角座標系と東京湾平均海面を基準とする標高の複合座標参照系」で記述されており、他のデータと異なっている

現在地下埋設物が配置されている竹芝モデルを対象とし、座標変換に対応した (実際は実装の簡素化のため、平面直角座標系を6697に一旦変換してから、実装済みの変換を適用している)

各ジオメトリに紐付けられているEPSGコードをgml内から取得し適用している

Notes(連絡事項)

coderabbitai[bot] commented 3 weeks ago

Walkthrough

このプルリクエストでは、CityGMLデータの座標参照系(CRS)の扱いを改善するために、複数のメソッドのシグネチャが変更され、EPSGコードをオプションとして受け取るようになりました。また、ファイル名からEPSGコードを抽出する新しいユーティリティ関数が追加され、座標変換のロジックがリファクタリングされました。これにより、地下埋設物データの処理が柔軟かつ効率的に行えるようになります。

Changes

ファイル 変更概要
nusamai/src/source/citygml.rs query_crs_from_filename関数を追加し、ファイル名からEPSGコードを抽出する機能を実装。toplevel_dispatcher関数にファイル名パラメータを追加しました。
nusamai/src/transformer/transform/projection.rs 座標変換のロジックをtransform_from_jgd2011transform_from_wgs84メソッドに分割し、可読性と保守性を向上させました。
nusamai-citygml/src/geometry.rs GeometryCollector構造体にgeometry_crs_uriフィールドを追加し、into_geometriesメソッドでEPSGコードの柔軟な指定を可能にしました。
nusamai-citygml/src/parser.rs SubTreeReaderのジオメトリ解析ロジックにEPSGコードを抽出する機能を追加し、ジオメトリコレクタにCRS URIを格納するようにしました。
nusamai-citygml/src/values.rs Envelope構造体にcrs_uriフィールドを追加し、parseメソッドで@srsName属性を抽出する機能を実装しました。
nusamai-plateau/examples/parse_and_compress.rs example_toplevel_dispatcher関数内のcollect_geometries呼び出しを更新し、Noneを引数として渡すようにしました。
nusamai-plateau/tests/common/mod.rs toplevel_dispatcher関数内のcollect_geometries呼び出しを更新し、Noneを引数として渡すようにしました。

Assessment against linked issues

Objective Addressed Explanation
地下埋設物のCityGMLデータに対応する(#500)
平面直角からWGS 84への座標変換を実装する(#500)

うさぎの詩

ぴょんぴょん跳ねて、
新しい道を見つけ、
EPSGコードの旅、
ファイル名からの魔法、
地下埋設物も、
みんなで楽しもう! 🐇✨


Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 41fc9a60a42295ec221ae9c139884699f461dcf1 and 911a97a2288a4f7f73367fc1083a40f7e64c1f2e.
Files selected for processing (1) * nusamai/src/source/citygml.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1) * nusamai/src/source/citygml.rs
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 35.04274% with 76 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nusamai/src/transformer/transform/projection.rs 16.66% 75 Missing :warning:
nusamai-citygml/src/geometry.rs 90.00% 1 Missing :warning:
Additional details and impacted files | [Components](https://app.codecov.io/gh/MIERUNE/plateau-gis-converter/pull/640/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MIERUNE) | Coverage Δ | | |---|---|---| | [GUI](https://app.codecov.io/gh/MIERUNE/plateau-gis-converter/pull/640/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MIERUNE) | `∅ <ø> (∅)` | | | [Backend](https://app.codecov.io/gh/MIERUNE/plateau-gis-converter/pull/640/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MIERUNE) | `74.18% <18.47%> (-0.19%)` | :arrow_down: | | [Libraries](https://app.codecov.io/gh/MIERUNE/plateau-gis-converter/pull/640/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MIERUNE) | `89.69% <96.00%> (+0.01%)` | :arrow_up: |

:loudspeaker: Thoughts on this report? Let us know!

nokonoko1203 commented 3 weeks ago

@TadaTeruki PR確認中ですが、lintが落ちてしまっているので、確認していただけますか! https://github.com/MIERUNE/plateau-gis-converter/actions/runs/10794488362/job/29938886874?pr=640#step:8:396

nokonoko1203 commented 3 weeks ago

変換して表示できることは確認ずみ

TadaTeruki commented 3 weeks ago

https://github.com/MIERUNE/plateau-gis-converter/pull/640#issuecomment-2345387377

Lintの落ち、手元でclippyし確認しました

変更を新しいブランチに置きました https://github.com/MIERUNE/plateau-gis-converter/tree/lint/fix/unf-coord-transformation

おそらく自分の変更ではないため、念の為別ブランチに移しています。 特に支障なければこのPRで一緒にマージしてしまいます。

TadaTeruki commented 3 weeks ago

また余談ですが、cargo fmt時に毎回importの順番が変わり、変更が入る箇所があります (plateau-gis-converter/nusamai/src/sink/geojson/mod.rsの27行目)

    transformer::{TransformerRegistry, TransformerOption},

同様の箇所が複数あり、diffが冗長となってしまいます。 この際この部分も直せればと思うのですが、いかがでしょうか。

nokonoko1203 commented 3 weeks ago

同様の箇所が複数あり、diffが冗長となってしまいます。 この際この部分も直せればと思うのですが、いかがでしょうか

修正お願いします!!

nokonoko1203 commented 2 weeks ago

@TadaTeruki lgtmです! コンフリクトしてる箇所だけ修正お願いします!