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

Support the 100m grid #51

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@ A QGIS Plugin to handle common Japanese grid square codes — 日本で使われ

プロセッシングツールボックスに追加される「地域メッシュ」メニュー、またはツールバー上のアイコンから呼び出して利用できます。

機能の要望や問題点の報告を歓迎いたします。 GitHub の Issue にどうぞ。
機能の要望や問題点の報告を歓迎いたします。GitHub の Issue にどうぞ。

## Install (インストール)
## Installation (インストール)

本プラグインは QGIS Python Plugin Repository で公開されており、QGIS の「プラグインの管理とインストール」から “[Japanese Grid Mesh](https://plugins.qgis.org/plugins/japanese_grids/)” で検索してインストールできます。

主にプロセッシングプラグインとして機能します。プロセッシングツールボックスから呼び出して利用できます。

## License (ライセンス)

License: GPL v2
GPL v2

## Development (開発)
## Development

QGIS にデプロイする:

```console
make deploy
```

## Authors
## Contributions

- MIERUNE Inc.
- Taku Fukada ([@ciscorn](https://github.com/ciscorn)) - original author
機能の要望や問題点の報告を歓迎いたします。GitHub の Issue にどうぞ。

### Authors

- Taku Fukada ([@ciscorn](https://github.com/ciscorn)) - Original Author
- And all contributors

16 changes: 14 additions & 2 deletions japanese_grids/algorithms/create_grid_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ def _tr(string: str):
"max_scale": 4000,
"min_scale": 120000,
},
"m100": {
"param": "OUTPUT_100M",
"default": False,
"label": _tr("100mメッシュ"),
"max_scale": 250,
"min_scale": 10000,
},
}

_CRS_SELECTION = [
Expand Down Expand Up @@ -249,9 +256,12 @@ def processAlgorithm(
dest_ids[layer_kind_name] = dest_id
result[layer_kind["param"]] = dest_id

if layer_kind_name in ["quarter", "eighth"] and extent_bbox is None:
if (
layer_kind_name in ["quarter", "eighth", "100m"]
and extent_bbox is None
):
raise QgsProcessingException(
"1/4メッシュ、1/8メッシュを出力する場合は、思わぬ大量の地物生成を防ぐため、メッシュの作成範囲を指定する必要があります。"
"1/2メッシュよりも細かいメッシュを出力する場合は、思わぬ大量の地物生成を防ぐため、メッシュの作成範囲を指定する必要があります。"
)

# Set post-processor
Expand All @@ -273,6 +283,7 @@ def processAlgorithm(
half="half" in sinks,
quarter="quarter" in sinks,
eighth="eighth" in sinks,
m100="m100" in sinks,
double="double" in sinks,
quintuple="quintuple" in sinks,
)
Expand All @@ -285,6 +296,7 @@ def processAlgorithm(
half="half" in sinks,
quarter="quarter" in sinks,
eighth="eighth" in sinks,
m100="m100" in sinks,
double="double" in sinks,
quintuple="quintuple" in sinks,
)
Expand Down
2 changes: 1 addition & 1 deletion japanese_grids/algorithms/create_legacy_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def processAlgorithm(
dest_ids[layer_kind_name] = dest_id
result[layer_kind["param"]] = dest_id

if layer_kind_name in ["quarter", "eighth"] and extent_bbox is None:
if layer_kind_name in ["lv1000", "lv500"] and extent_bbox is None:
raise QgsProcessingException(
"地図情報レベル 1000, 500 を出力する場合は、思わぬ大量の地物生成を防ぐため、メッシュの作成範囲を指定する必要があります。"
)
Expand Down
23 changes: 21 additions & 2 deletions japanese_grids/algorithms/utils/grid_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,22 @@ def _iter_patch( # noqa: C901
half: bool = False,
quarter: bool = False,
eighth: bool = False,
m100: bool = False,
double: bool = False,
quintuple: bool = False,
) -> Iterator[tuple[str, str, LngLatBox]]:
for primary_mesh_patch in _iter_primary_mesh_patch(extent=extent):
if primary:
yield ("primary", *primary_mesh_patch)
if not (
secondary or standard or half or quarter or eighth or quintuple or double
secondary
or standard
or half
or quarter
or eighth
or m100
or quintuple
or double
):
continue

Expand All @@ -324,13 +332,19 @@ def _iter_patch( # noqa: C901
):
yield ("double", *double_mesh_patch)

if not (standard or half or quarter or eighth):
if not (standard or half or quarter or eighth or m100):
continue
for standard_mesh_patch in _iter_standard_mesh_patch(
secondary_mesh_patch, extent
):
if standard:
yield ("standard", *standard_mesh_patch)
if m100:
for m100_mesh_patch in _iter_standard_mesh_patch(
standard_mesh_patch, extent
):
yield ("m100", *m100_mesh_patch)

if half or quarter or eighth:
for patch2 in _iter_subdivided_mesh_patch(
standard_mesh_patch, extent
Expand All @@ -356,6 +370,7 @@ def iter_patch(
half: bool = False,
quarter: bool = False,
eighth: bool = False,
m100: bool = False,
double: bool = False,
quintuple: bool = False,
) -> Iterator[tuple[str, str, LngLatBox]]:
Expand All @@ -368,6 +383,7 @@ def iter_patch(
half=half,
quarter=quarter,
eighth=eighth,
m100=m100,
double=double,
quintuple=quintuple,
):
Expand All @@ -392,6 +408,7 @@ def estimate_total_count(
half: bool = False,
quarter: bool = False,
eighth: bool = False,
m100: bool = False,
double: bool = False,
quintuple: bool = False,
):
Expand All @@ -415,4 +432,6 @@ def estimate_total_count(
c += num_primary * 64 * 100 * 4 * 4
if eighth:
c += num_primary * 64 * 100 * 4 * 4 * 4
if m100:
c += num_primary * 64 * 100 * 10 * 10
return c
2 changes: 1 addition & 1 deletion japanese_grids/metadata.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[general]
name=Japanese Grid Mesh
version=1.4.1
version=1.5.0
qgisMinimumVersion=3.6
description=Create common grid squares used in Japan. 日本で使われている「標準地域メッシュ」および「国土基本図図郭」のポリゴンを作成できるほか、国勢調査や経済センサスなどの「地域メッシュ統計」のCSVファイルを読み込むこともできます。プロセッシングツールボックスから利用できます。また、地図キャンバス上のマウスカーソル位置の地域メッシュコードをリアルタイムに表示するパネルも搭載しています。
author=MIERUNE Inc.
Expand Down