Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gpkg, GeoJSON のジオメトリ生成コードを汎化する #154

Merged
merged 2 commits into from
Jan 7, 2024

Conversation

ciscorn
Copy link
Member

@ciscorn ciscorn commented Jan 7, 2024

nusamai-gpkg と nusamai-geojson において、(vertices+indices) な表現のジオメトリと、そうでないふつうのジオメトリを、なるべく共通のコードで扱えるようにする。

@ciscorn ciscorn force-pushed the refactor-gpkg-geom branch 2 times, most recently from a577dfe to a483853 Compare January 7, 2024 05:13
@ciscorn ciscorn force-pushed the refactor-gpkg-geom branch from a483853 to 7dcf1e7 Compare January 7, 2024 05:27
Copy link

codecov bot commented Jan 7, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Files Patch % Lines
nusamai-geojson/src/conversion.rs 97.70% 2 Missing ⚠️
nusamai/src/sink/gpkg/mod.rs 75.00% 2 Missing ⚠️
Additional details and impacted files
Components Coverage Δ
GUI ∅ <ø> (∅)
Backend 75.77% <75.00%> (+0.16%) ⬆️
Libraries 86.35% <98.47%> (-0.02%) ⬇️

📢 Thoughts on this report? Let us know!

@ciscorn ciscorn changed the title Gpkg のジオメトリ生成コードのリファクタリング Gpkg, GeoJSON のジオメトリ生成コードを汎化する Jan 7, 2024
@ciscorn ciscorn changed the base branch from main to swap-xy January 7, 2024 06:38
@ciscorn ciscorn force-pushed the refactor-gpkg-geom branch from d5516c7 to 788b9fd Compare January 7, 2024 06:45
@ciscorn ciscorn self-assigned this Jan 7, 2024
@ciscorn ciscorn force-pushed the refactor-gpkg-geom branch from 788b9fd to 22e6d8c Compare January 7, 2024 06:57
@ciscorn ciscorn requested a review from a team January 7, 2024 06:59
@ciscorn ciscorn marked this pull request as ready for review January 7, 2024 07:01
@ciscorn ciscorn merged commit eb90961 into swap-xy Jan 7, 2024
4 checks passed
@ciscorn ciscorn deleted the refactor-gpkg-geom branch January 7, 2024 07:04
ciscorn added a commit that referenced this pull request Jan 8, 2024
## 変更内容

### 仮のTransformerで「とりあえず」の変換処理を行う
- x-y 入れかえ処理を入れておく
    - これにともない GeoJSON, GeoPackage ドライバ内での x-y 入れかえは除去する
- WGS 84 にしておく処理も追加 #155

### Gpkg, GeoJSON 周りのリファクタリング
- `nusamai-geojson` に "indexed" でないふつうのジオメトリをGeoJSON
Valueに変換する関数を追加(tiling2d sink で使う)。
    - #154 もこのPRにマージ
- Gpkg のバイナリジオメトリの構築で、 `Vec<u8>` でなく `std::io::Write` trait
を使う(`Vec<u8>`はWrite)。一時的なVecの生成も除去。

---

Closes: #125
Closes: #76
ciscorn added a commit that referenced this pull request Jan 9, 2024
## 変更内容

### #153 

#### 仮のTransformerで「とりあえず」の全頂点の変換処理を行う
- x-y 入れかえ処理を入れておく
    - これにともない GeoJSON, GeoPackage ドライバ内での x-y 入れかえは除去する
- CRSを WGS 84 にしておく処理も追加 #155

#### Gpkg, GeoJSON 周りのリファクタリング
- `nusamai-geojson` に "indexed" でないふつうのジオメトリをGeoJSON
Valueに変換する関数を追加(tiling2d sink で使う)。
    - #154 もこのPRにマージ
- Gpkg のバイナリジオメトリの構築で、 `Vec<u8>` でなく `std::io::Write` trait
を使う(`Vec<u8>`はWrite)。一時的なVecの生成も除去。

### その他

- Gpkg sink が、インメモリSQLiteを扱えていない(`:memory:` というファイルを作ってしまう)問題を修正
- SipHash → aHash #156
- Iterator::chain 除去 #157
- Noop Sink, Serde Sinkを走らせるだけのテストに GeoJSONとGPKG も追加
- `nusamai_citygml::object::Geometries` の名前を `GeometryStore`
に変更(ジオメトリのつめあわせであることを多少分かりやすく)
- `GeometryStore` にCRSの情報をもたせられるようにしておく(仮)
- その他細かい調整など
sorami added a commit that referenced this pull request Jan 26, 2024
## 概要
- [x] `nusamai-shapefile` クレートの作成
- [x] `nusamai_geometry::MultiPoint` から Shapefile形式への変換
- [x] `examples/{read,write}.rs` - ファイル読み書きの参考例(tmp - 最終的に削除する)

まず例として小さく、MultiPointの部分のみを作ったプルリクです。方向性に問題ないかご確認いただけますでしょうか!

外部クレート [shapefile](https://docs.rs/shapefile/latest/shapefile/)
を用いて実装しています。

リファクタしてもらった `nusamai-geojson` の形(#154)をもとにしています(ので、それをやった @ciscorn
さんを明示的にレビューアーへ入れてみました)。

3D地物(`nusamai_geometry::MultiPoint::<3>`,
`shapefile::MultiPointZ`)のみで、2Dは考慮していません。

## その後の進め方

related #198

この方向性で問題なければ、それを踏まえて、以下の順に進めていく予定です:

- MultiLineString, MultiPolygonの変換
- Shapefile全体での出力
- Shapefile Sink
- (属性付与)

---------

Co-authored-by: Taku Fukada <naninunenor@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant