[postgis-devel] [PostGIS] #2105: [raster] ST_Transform needs an alignment parameter
PostGIS
trac at osgeo.org
Mon Nov 26 12:11:53 PST 2012
#2105: [raster] ST_Transform needs an alignment parameter
-------------------------+--------------------------------------------------
Reporter: dustymugs | Owner: dustymugs
Type: enhancement | Status: new
Priority: medium | Milestone: PostGIS 2.1.0
Component: raster | Version: trunk
Keywords: |
-------------------------+--------------------------------------------------
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
)
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2105>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list