[postgis-users] raster, stats conditioned to a set of values

juli g. pausas juli.g.pausas at uv.es
Mon Jul 6 07:51:58 PDT 2015


You are right! after a long list of messages, it finally get a map that
looks alright.
The two rasters do intersect because they come from the same file:

In case you'd like to see it here is a small example (1.3 MB):
https://dl.dropboxusercontent.com/u/1571018/prova.tif

-- uploaded to postgress as:
raster2pgsql -C -s 4326 -t 10x10 -I -M -Y prova.tif rastertmp.prova | psql
-d bd_cide

-- create the 1/null map (for positive/negative values)
CREATE TABLE rastertmp.provapositiu (rid serial, rast raster);
INSERT INTO rastertmp.provapositiu
    SELECT rid, ST_RECLASS (ST_Band(rast, 1), 1, '[1-10000]:1', '2BUI', -9)
    FROM rastertmp.prova;

-- looking OK

CREATE TABLE rastertmp.provanet (rid serial, rast raster);
INSERT INTO rastertmp.provanet
    SELECT t1.rid, ST_Union(ST_Intersection(t1.rast, 1, t2.rast, 1,
'BAND1'))
    FROM rastertmp.prova AS t1, rastertmp.provapositiu AS t2
    WHERE ST_Intersects(t1.rast, t2.rast)
    GROUP BY t1.rid;

NOTICE:  The two rasters provided have no intersection.  Returning no band
raster
CONTEXT:  PL/pgSQL function
st_intersection(raster,integer,raster,integer,text,double precision[]) line
20 at assignment
NOTICE:  Could not find raster band of index 1 when setting pixel value.
Nodata value not set. Returning original raster
CONTEXT:  PL/pgSQL function
st_intersection(raster,integer,raster,integer,text,double precision[]) line
21 at assignment
NOTICE:  The two rasters provided have no intersection.  Returning no band
raster
CONTEXT:  PL/pgSQL function
st_intersection(raster,integer,raster,integer,text,double precision[]) line
20 at assignment
NOTICE:  Could not find raster band of index 1 when setting pixel value.
Nodata value not set. Returning original raster
CONTEXT:  PL/pgSQL function
st_intersection(raster,integer,raster,integer,text,double precision[]) line
21 at assignment

etc... a long list of these messages ...

But at the end it produces the map that seems OK.


Juli
--
*CIDE, CSIC*  |  www.uv.es/jgpausas  |


On Mon, Jul 6, 2015 at 4:12 PM, Pierre Racine <Pierre.Racine at sbf.ulaval.ca>
wrote:

> These are not error. Only notices. Are you sure the query returned nothing?
>
> Otherwise I would restart with something more simple to double check some
> prerequired things.
>
> 1) Make sure your two raster table actually contains pixels with values
>
> 2) Make sure some tiles actually intersects
>
> Do you have a way to display the footprints of your rasters tiles?
>
> Pierre
>
> > -----Original Message-----
> > From: juli g. pausas [mailto:juli.g.pausas at uv.es]
> > Sent: Monday, July 06, 2015 9:58 AM
> > To: Pierre Racine
> > Cc: PostGIS Users Discussion
> > Subject: Re: [postgis-users] raster, stats conditioned to a set of values
> >
> >
> > INSERT INTO rastertmp.provanet
> >     SELECT t1.rid, ST_Union(ST_Intersection(t1.rast, 1, t2.rast, 1,
> 'BAND1'))
> >     FROM rastertmp.prova AS t1, rastertmp.provapositiu AS t2
> >     WHERE ST_Intersects(t1.rast, t2.rast)
> >     GROUP BY t1.rid;
> >
> >
> > NOTICE:  The two rasters provided have no intersection.  Returning no
> band
> > raster
> > CONTEXT:  PL/pgSQL function
> > st_intersection(raster,integer,raster,integer,text,double precision[])
> line 20
> > at assignment
> > NOTICE:  Could not find raster band of index 1 when setting pixel value.
> > Nodata value not set. Returning original raster
> >
> >
> >
> >
> > Juli
> > --
> > CIDE, CSIC  |  www.uv.es/jgpausas  |
> >
> >
> >
> > On Mon, Jul 6, 2015 at 3:52 PM, Pierre Racine
> > <Pierre.Racine at sbf.ulaval.ca> wrote:
> >
> >
> >       > Adding a GROUP BY t1.rid, doesn't solve the problem, still get an
> > error.
> >
> >       Which error?
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150706/1ddc6070/attachment.html>


More information about the postgis-users mailing list