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

Fix: e-Statの1kmメッシュの読み込みが壊れている #48

Merged
merged 1 commit into from
Jun 30, 2024
Merged
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
6 changes: 5 additions & 1 deletion japanese_grids/algorithms/utils/gridsquare_to_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ def grid_square_code_to_bbox( # noqa: C901
if length == 6:
return (lng, lat / 1.5, lng + 0.125, (lat + 0.125) / 1.5)

# 1km
lat10 = int(code[6]) * 0.125
lng10 = int(code[7]) * 0.125
if length == 8:
lat1 = lat + lat10 / 10
lng1 = lng + lng10 / 10
lat2 = lat + (lat10 + 0.125) / 10
lng2 = lng + (lng10 + 0.125) / 10
return (lng1, lat1 / 1.5, lng, lat / 1.5)
return (lng1, lat1 / 1.5, lng2, lat2 / 1.5)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原因


# 1/2 (500m)
a = code[8]
if a not in _VALID_QUAD:
return None
Expand All @@ -47,6 +49,7 @@ def grid_square_code_to_bbox( # noqa: C901
lng2 = lng + (lng10 + 0.0625) / 10
return (lng1, lat1 / 1.5, lng2, lat2 / 1.5)

# 1/4 (250m)
a = code[9]
if a not in _VALID_QUAD:
return None
Expand All @@ -61,6 +64,7 @@ def grid_square_code_to_bbox( # noqa: C901
lng2 = lng + (lng10 + 0.03125) / 10
return (lng1, lat1 / 1.5, lng2, lat2 / 1.5)

# 1/8 (125m)
a = code[10]
if a not in _VALID_QUAD:
return None
Expand Down
Loading