Commit 790f448d authored by Sandro Santilli's avatar Sandro Santilli

Fix output georeference on warping rasters with default georeference

Closes #2911 and re-closes #2251

git-svn-id: http://svn.osgeo.org/postgis/trunk@12928 b70326c6-7e19-0410-871a-916f4a2858ee
parent 91f0500d
......@@ -29,6 +29,9 @@
*
*/
#include "../../postgis_config.h"
//#define POSTGIS_DEBUG_LEVEL 4
#include "librtcore.h"
#include "librtcore_internal.h"
......@@ -990,6 +993,12 @@ rt_raster rt_raster_gdal_warp(
/* substitute spatial, reset back to default */
if (subspatial) {
double gt[6] = {0, 1, 0, 0, 0, -1};
/* See http://trac.osgeo.org/postgis/ticket/2911 */
/* We should proably also tweak rotation here */
/* NOTE: the times 10 is because it was divided by 10 in a section above,
* I'm not sure the above division was needed */
gt[1] = _scale[0] * 10;
gt[5] = -1 * _scale[1] * 10;
rt_raster_set_geotransform_matrix(rast, gt);
rt_raster_set_srid(rast, SRID_UNKNOWN);
......
......@@ -835,14 +835,14 @@ SELECT
ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)
, 1, '8BUI', 255, 0
)
, 0.25, 0.9
, 0.25, 0.8
) AS rast
UNION ALL
SELECT -- ticket #2188
4 AS rid,
ST_Resize(
ST_AddBand(
ST_MakeEmptyRaster(1024, 768, 0, 0, 1, -1, 0, 0, 0)
ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)
, 1, '8BUI', 255, 0
)
, 0.5, 0.5
......
......@@ -25,9 +25,9 @@ NOTICE: Values must be provided for both X and Y when specifying the scale. Re
0.22|993310|26|26|1|500.000|500.000|0.000|6.000|950452.000|1396632.000|t|t|t
0.23|984269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t
0.24|974269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t
0.25|0|5|5|1|1.000|-1.000|0.000|0.000|0.000|0.000|t|t|t
0.26|0|2|2|1|1.000|-1.000|0.000|0.000|0.000|0.000|t|t|t
0.27|0|100|100|1|1.000|-1.000|0.000|0.000|0.000|0.000|t|t|t
0.25|0|5|5|1|2.000|-2.000|0.000|0.000|0.000|0.000|t|t|t
0.26|0|2|2|1|5.000|-5.000|0.000|0.000|0.000|0.000|t|t|t
0.27|0|100|100|1|0.100|-0.100|0.000|0.000|0.000|0.000|t|t|t
0.3|994269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t
0.4|993310|24|24|1|500.000|500.000|0.000|0.000|950732.188|1397281.783|t|t|t
0.5|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t
......@@ -121,10 +121,10 @@ NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL War
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
1|0|0|500|500|1|-1|0|0|0|1|250000|63750000|255|0|255|255
2|0|0|500|100|1|-1|0|0|0|1|50000|12750000|255|0|255|255
3|0|0|250|900|1|-1|0|0|0|1|225000|57375000|255|0|255|255
4|0|0|512|384|1|-1|0|0|0|1|196608|50135040|255|0|255|255
1|0|0|500|500|2|-2|0|0|0|1|250000|63750000|255|0|255|255
2|0|0|500|100|2|-10|0|0|0|1|50000|12750000|255|0|255|255
3|0|0|250|800|4|-1.25|0|0|0|1|200000|51000000|255|0|255|255
4|0|0|500|500|2|-2|0|0|0|1|250000|63750000|255|0|255|255
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
(0,0,5,5,1,-1,0,0,0,1)|(0,0,5,5,1,-1,0,0,0,1)
(0,0,5,5,2,-2,0,0,0,1)|(0,0,5,5,2,-2,0,0,0,1)
......@@ -3,5 +3,16 @@ SELECT '#1485', count(*) FROM geometry_columns
WHERE f_table_name = 'raster_columns';
-- #2532
SELECT NULL::raster @ null::geometry;
SELECT NULL::geometry @ null::raster;
SELECT '#2532.1', NULL::raster @ null::geometry;
SELECT '#2532.2', NULL::geometry @ null::raster;
-- #2911
WITH data AS ( SELECT '#2911' l, ST_Metadata(ST_Rescale(
ST_AddBand(
ST_MakeEmptyRaster(10, 10, 0, 0, 1, -1, 0, 0, 0),
1, '8BUI', 0, 0
),
2.0,
-2.0
)) m
) SELECT l, (m).* FROM data;
#1485|0
#2532.1|
#2532.2|
NOTICE: Raster has default geotransform. Adjusting metadata for use of GDAL Warp API
#2911|0|0|5|5|2|-2|0|0|0|1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment