[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] Raster cell size and wrong mean value calculation problem
From: Simon Appelt <flansch () gmx ! de>
Date: 2013-01-23 20:08:43
Message-ID: 5100434B.1060601 () gmx ! de
[Download RAW message or body]
Hi Bborie,
thanks for your fast answer! Wow, i really missed to read that :-(
But my second query ,which i posted below, provides the same Mean-Value
result as the first. If i understand you correct, the st_clip command
should end up with a different result .
Well i'll do some further testing tomorrow and keep the list up to date.
Simon
Am 23.01.2013 17:05, schrieb Bborie Park:
> By the looks of the docs for ST_Intersection, what you're getting is
> correct. The second paragraph indicates that the raster gets
> vectorized using ST_DumpAsPolygon() which does merge neighboring cells
> with the same value in one larger geometry.
>
> http://postgis.net/docs/manual-2.0/RT_ST_Intersection.html
>
> The query using ST_Clip is more appropriate.
>
> -bborie
>
> On Wed, Jan 23, 2013 at 6:33 AM, <fLaNsch@gmx.de> wrote:
> > Hi Postgis User-list,
> >
> > i've downloaded and migrated some srtm3 rasterdata into my PostgreSQL/Postgis 2.0 \
> > Database successfully. Now i would like to calculate the mean elevation value of \
> > a given polygon area by intersecting my polygon layer with the raster grid.
> > Using a SQL-Statement, which was shown by Pierre Racine at the FOSS4G 2011:
> >
> > SELECT polyID,
> > (ST_Intersection(geom, rast)).geom poly,
> > (ST_Intersection(geom, rast)).val elevation
> > FROM polygon, srtm WHERE ST_Intersects(geom, rast);
> >
> >
> > What i expected the polygon-result geometry would look like:
> > _ _ _ _
> > > _|_|_|_|
> > > _|_|_|_|
> > > _|_|_|_|
> > > _|_|_|_|
> >
> > What the result actually looks like:
> > _ _ _ _
> > > ___|_ |
> > > _ |_| |
> > > _|___|_|
> > > _|_|_|_|
> >
> >
> > The raster cells with the same elevation value got merged, why?
> > The mean value which based on the actual result cannot be correct. Same result \
> > different SQL-Statement without selecting the geometry:
> > Select polyid,(stats).mean from (Select \
> > a.polyid,st_summarystats(st_clip(b.rast,1,a.geom))as stats from polygon a, srtm b \
> > where ST_intersects(a.geom,b.rast )
> >
> > I'm very grateful for any help!
> >
> > Best regards,
> > Simon
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users@lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic