Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix implicitNotFound error and rename RGBAMethods implicit class [#3563](https://github.com/locationtech/geotrellis/pull/3563)
- Set 'role' attribute in GDALMetadata tag written to tiff header, to match GDAL behaviour. [#3496](https://github.com/locationtech/geotrellis/issues/3496)
- Avoid GeoAttrsError by using more robust target extent calculation [#3572](https://github.com/locationtech/geotrellis/pull/3572)
- ReprojectRasterExtent: support single pixel input [#3573](https://github.com/locationtech/geotrellis/pull/3573)

## [3.7.1] - 2024-01-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ object ReprojectRasterExtent {
val cols = ge.extent.width / ge.cellwidth
val rows = ge.extent.height / ge.cellheight
val pixelSize = distance / math.sqrt(cols * cols + rows * rows)
(pixelSize, pixelSize)
val pixelWidth = if(newExtent.width < 0.5 * pixelSize) newExtent.width else pixelSize
val pixelHeight = if(newExtent.height < 0.5*pixelSize) newExtent.height else pixelSize
(pixelWidth, pixelHeight)
}

val newCols = (newExtent.width / pixelSizeX + 0.5).toLong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,13 @@ class ReprojectRasterExtentSpec extends AnyFunSpec
assert(destinationRE.extent covers region)
assert(destinationRE.extent.toPolygon() intersects region)
}

it("should reproject single pixel extents") {
val inputExtent = GridExtent[Long](Extent(429180.0, 7652390.0, 429190.0, 7652400.0), CellSize(10.0, 10.0))
val destinationRE = ReprojectRasterExtent(inputExtent, CRS.fromEpsgCode(32639), LatLng)

assert(destinationRE.cols == 1)
assert(destinationRE.rows == 1)
}
}
}
Loading