diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0f9f940..cd08d47 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -22,7 +22,7 @@ See [this page](https://plantcv.readthedocs.io/en/latest/pr_review_process/) for - [ ] All tests pass - [ ] Test coverage remains 100% - [ ] Documentation tested -- [ ] New documentation pages added to `plantcv/mkdocs.yml` -- [ ] Changes to function input/output signatures added to `updating.md` +- [ ] New documentation pages added to `plantcv-geospatial/mkdocs.yml` +- [ ] Changes to function input/output signatures added to `changelog.md` - [ ] Code reviewed - [ ] PR approved diff --git a/plantcv/geospatial/read_geotif.py b/plantcv/geospatial/read_geotif.py index 4d33190..055e240 100644 --- a/plantcv/geospatial/read_geotif.py +++ b/plantcv/geospatial/read_geotif.py @@ -90,8 +90,9 @@ def _read_geotif_and_shapefile(filename, cropto): shapes = [mapping(convex_hull)] # rasterio does the cropping within open with rasterio.open(filename, 'r') as src: - img_data, _ = mask(src, shapes, crop=True) + img_data, trans_metadata = mask(src, shapes, crop=True) metadata = src.meta.copy() + metadata.update({"transform": trans_metadata}) d_type = src.dtypes[0] else: diff --git a/plantcv/geospatial/transform_points.py b/plantcv/geospatial/transform_points.py index afb6eee..91d3412 100644 --- a/plantcv/geospatial/transform_points.py +++ b/plantcv/geospatial/transform_points.py @@ -19,11 +19,11 @@ def transform_points(img, geojson): coord = [] with fiona.open(geojson, 'r') as shapefile: - for i, _ in enumerate(shapefile): - if type((shapefile[i].geometry["coordinates"])) is list: - pixel_point = ~(geo_transform) * (shapefile[i].geometry["coordinates"][0]) - if type((shapefile[i].geometry["coordinates"])) is tuple: - pixel_point = ~(geo_transform) * (shapefile[i].geometry["coordinates"]) + for row in shapefile: + if type((row.geometry["coordinates"])) is list: + pixel_point = ~(geo_transform) * (row.geometry["coordinates"][0]) + if type((row.geometry["coordinates"])) is tuple: + pixel_point = ~(geo_transform) * (row.geometry["coordinates"]) rounded = (int(pixel_point[0]), int(pixel_point[1])) coord.append(rounded)