Opened 11 years ago

Closed 11 years ago

#2105 closed enhancement (fixed)

[raster] ST_Transform needs an alignment parameter

Reported by: Bborie Park Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.1.0
Component: raster Version: master
Keywords: history Cc:

Description

A significant limitation of ST_Transform(raster) is that if you were to run ST_Transform(raster) on a table of aligned rasters, the output probably is not aligned…

SELECT
ST_Transform(rast, 4326)
FROM my_aligned_rasters_table

What is needed is an alignment parameter (a reference raster that the transformed rasters are aligned to).

WITH foo AS (
SELECT
ST_Transform(rast, 4326) AS alignto
FROM my_aligned_rasters_table
WHERE rid = 1
)
SELECT
ST_Transform(rast, alignto)
FROM my_aligned_rasters_table
CROSS JOIN foo

Since the reference raster already has the desired SRID, keeping the SRID parameter is redundant and can be removed…

CREATE OR REPLACE FUNCTION st_transform(
	rast raster, 
	alignto raster,
	algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125
)

Change History (1)

comment:1 by Bborie Park, 11 years ago

Keywords: history added
Resolution: fixed
Status: newclosed

Added in r10741

Note: See TracTickets for help on using tickets.