Skip to content

Commit

Permalink
fix rasterio index issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hambsch committed Nov 29, 2024
1 parent d9a6ba4 commit 23b9eef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/guppy/endpoints/endpoint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@ def sample_coordinates_window(coords_dict, layer_models, bounds, round_val=None)
coords.extend(v)
with rasterio.open(path) as src:
geometry_window = from_bounds(bounds[0], bounds[1], bounds[2], bounds[3], src.transform).round_offsets()
rows, cols = src.index([p[0] for p in coords], [p[1] for p in coords])
rows = []
cols = []
for x, y in zip([p[0] for p in coords], [p[1] for p in coords]):
row, col = src.index(x, y)
rows.append(row)
cols.append(col)
cols = [c - geometry_window.col_off for c in cols]
rows = [r - geometry_window.row_off for r in rows]
in_rows = []
Expand Down

0 comments on commit 23b9eef

Please sign in to comment.