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

CRSを設定するオプションを追加する #9

Open
Kanahiro opened this issue Jun 12, 2024 · 1 comment
Open

CRSを設定するオプションを追加する #9

Kanahiro opened this issue Jun 12, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Kanahiro
Copy link
Member

Kanahiro commented Jun 12, 2024

gdalwarpに倣って、-te -te_srs、としようとしていましたが、teは「一部を切り抜くオプション」であり、誤解をうむ可能性があるため、やめます。

CRSを上書きするものなので、gdal_edit.pyに倣って:

  • CRSの指定は-a_srsとしましょう。
  • 領域を、-a_ullrとしましょう(ullrってなんだろうと考えたら、upper left, lower rightですね)

reference: https://gdal.org/programs/gdal_edit.html

@Kanahiro Kanahiro added the enhancement New feature or request label Jun 12, 2024
@geogra-geogra
Copy link
Member

geogra-geogra commented Jun 12, 2024

課題整理

現状把握

csmap-pyのなかでの挙動

process.py

    with rasterio.open(input_dem_path) as dem:
    ...
        with rasterio.open(
            output_path,
            "w",
            driver="GTiff",
            dtype=rasterio.uint8,
            count=4,
            width=out_width,
            height=out_height,
            crs=dem.crs,
            transform=transform,
            compress="LZW",
        ) as dst:

crs=dem.crs,のように、CRSがそのまま通るように書かれている

仕様

  • CRS定義済み+末指定→もとのCRS
    もとの通りの挙動(dem.crsをそのままcrsとして採用)

  • CRS未定義+未指定→CRS未定義
    もとの通りの挙動(dem.crsをそのままcrsとして採用、つまりCRSなし)

  • CRS定義済み+指定→指定したCRS
    DEMが指定しているCRSを指定したものに上書きする(再投影はしない)。

  • CRS未定義+指定→指定したCRS
    DEMにCRSが設定されていない場合にCRSを設定する。

ラスターの領域が示されないと(コード中のtranform)、正しい位置を参照することが出来ないため、gdal_edit.pyに倣って

  • CRSを指定するパラメータ -a_srs
  • 領域を指定するパラメータ -a_ullr
    とする

追加検討

ファイルを入力した時点で、CRSを取得して、ウィンドウに表示できるのが理想?
これはQGISプラグインにした時の話だった

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants