|
1 | 1 | from pathlib import Path
|
2 |
| -from typing import Tuple, Dict, Optional |
3 |
| -from math import ceil |
| 2 | +from typing import Dict, Optional |
4 | 3 |
|
5 | 4 | import requests
|
6 | 5 | from dagster import StaticPartitionsDefinition, get_dagster_logger
|
@@ -120,41 +119,3 @@ def download_ahn_index(
|
120 | 119 | features[f["properties"]["AHN"].lower()] = None
|
121 | 120 |
|
122 | 121 | return features
|
123 |
| - |
124 |
| - |
125 |
| -def tile_index_origin() -> Tuple[float, float, float, float]: # pragma: no cover |
126 |
| - """Computes the BBOX of the AHN tile index.""" |
127 |
| - tindex = download_ahn_index(True) |
128 |
| - minx, miny = tindex["01cz1"]["geometry"]["coordinates"][0][0] |
129 |
| - maxx, maxy = minx, miny |
130 |
| - for feature in tindex.values(): |
131 |
| - exterior = feature["geometry"]["coordinates"][0] |
132 |
| - for x, y in exterior: |
133 |
| - minx = x if x < minx else minx |
134 |
| - miny = y if y < miny else miny |
135 |
| - maxx = x if x > maxx else maxx |
136 |
| - maxy = y if y > maxy else maxy |
137 |
| - return minx, miny, maxx, maxy |
138 |
| - |
139 |
| - |
140 |
| -def generate_grid(bbox: Tuple[float, float, float, float], cellsize: int): |
141 |
| - """Generates a grid of fixed cell-size for a BBOX. |
142 |
| - The origin of the grid is the BBOX min coordinates. |
143 |
| -
|
144 |
| - Args: |
145 |
| - bbox: (minx, miny, maxx, maxy) |
146 |
| - cellsize: Cell size. |
147 |
| -
|
148 |
| - Returns: |
149 |
| - The bbox of the generated grid, nr. of cells in X-direction, |
150 |
| - nr. of cells in Y-direction. |
151 |
| - """ |
152 |
| - origin = bbox[:2] |
153 |
| - nr_cells_x = ceil((bbox[2] - bbox[0]) / cellsize) |
154 |
| - nr_cells_y = ceil((bbox[3] - bbox[1]) / cellsize) |
155 |
| - bbox_new = ( |
156 |
| - *origin, |
157 |
| - origin[0] + nr_cells_x * cellsize, |
158 |
| - origin[1] + nr_cells_y * cellsize, |
159 |
| - ) |
160 |
| - return bbox_new, nr_cells_x, nr_cells_y |
0 commit comments