[postgis-devel] [PostGIS] #1336: [raster] Problem with ST_MapAlgebraExpr() or ST_AsRaster() alignment
PostGIS
trac at osgeo.org
Wed Nov 30 11:08:36 PST 2011
#1336: [raster] Problem with ST_MapAlgebraExpr() or ST_AsRaster() alignment
----------------------------+-----------------------------------------------
Reporter: pracine | Owner: pracine
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis raster | Version: trunk
Keywords: |
----------------------------+-----------------------------------------------
I have a test raster that I display in Openjump:
{{{
CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8)
RETURNS raster AS
$$
DECLARE
BEGIN
RETURN ST_AddBand(ST_MakeEmptyRaster(h, w, 0, 0, 1, 1, 0, 0, 0),
'32BF', val, -1);
END;
$$
LANGUAGE 'plpgsql';
SELECT ST_AsBinary((ST_PixelAsPolygons(ST_TestRaster(10, 10, 2))).geom);
}}}
Then I have a simple overlapping geometry:
{{{
SELECT ST_AsBinary(ST_Buffer(ST_MakePoint(8, 5), 4));
}}}
If I convert it to a raster aligned on the first raster I get:
{{{
SELECT ST_AsBinary((gv).geom), (gv).val
FROM ST_PixelAsPolygons(ST_AsRaster(ST_Buffer(ST_MakePoint(8, 5), 4),
ST_TestRaster(10, 10, 2),
ST_BandPixelType(ST_TestRaster(10, 10,
2), 1),
1,
-10
)
) gv
}}}
The two rasters are well aligned. However if I try:
{{{
SELECT ST_MapAlgebraExpr(ST_TestRaster(10, 10, 2), 1,
ST_AsRaster(ST_Buffer(ST_MakePoint(8, 5), 4),
ST_TestRaster(10, 10, 2),
ST_BandPixelType(ST_TestRaster(10,
10, 2), 1),
1,
-10
), 1,
'rast1')
}}}
I get "NOTICE: The two rasters provided do not have the same alignment.
Returning NULL"...
If I just replace the rasterized geometry with the original raster like
this:
{{{
SELECT ST_MapAlgebraExpr(ST_TestRaster(10, 10, 2), 1,
ST_TestRaster(10, 10, 2), 1,
'rast1')
}}}
there is no problem...
I am trying to implement ST_Clip()...
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1336>
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