Merge remote-tracking branch 'gh/pr/686/merge'

This commit is contained in:
Darafei Praliaskouski 2022-05-15 21:59:47 +03:00
commit efdedcd74e
3 changed files with 16 additions and 1 deletions

View file

@ -3072,7 +3072,7 @@ rt_raster_gdal_rasterize(
double _w[2] = {0};
/* raster is already aligned */
if (FLT_EQ(*grid_xw, extent.UpperLeftX) && FLT_EQ(*grid_yw, extent.UpperLeftY)) {
if (DBL_EQ(*grid_xw, extent.UpperLeftX) && DBL_EQ(*grid_yw, extent.UpperLeftY)) {
RASTER_DEBUG(3, "Skipping raster alignment as it is already aligned to grid");
break;
}

View file

@ -158,3 +158,17 @@ ORDER BY 1, 2, 3, 4, 5, 6, 8;
DROP TABLE IF EXISTS geom_clip;
DROP TABLE IF EXISTS raster_clip;
DROP TABLE IF EXISTS raster_clip_out;
-- #5148 mask raster not aligned to input raster
SELECT
ST_UpperLeftX(rast) AS x,
ST_UpperLeftY(rast) AS y,
ST_Width(rast) AS w,
ST_Height(rast) AS h
FROM ST_Clip(
ST_AddBand(
ST_MakeEmptyRaster(100, 100, 0, 0.001, 1e-5, -1e-5, 0, 0, 0),
1, '8BUI', 1, 0
),
ST_GeomFromText('POLYGON((0 0.0009999, 0.0001 0.0009999, 0.0001 0.0009, 0 0.0009, 0 0.0009999))')
) AS rast;

View file

@ -524,3 +524,4 @@
4|2|5|3|4|2|3|POLYGON((3 -1,4 -1,4 -2,3 -2,3 -1))
4|2|5|3|4|3|3|POLYGON((3 -2,4 -2,4 -3,3 -3,3 -2))
4|2|5|3|4|4|3|POLYGON((3 -3,4 -3,4 -4,3 -4,3 -3))
0|0.001|10|10