[postgis-users] Finding highest cell value in raster using ST_Value

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon Jun 25 13:36:22 PDT 2012


Good find Bborie!

I would add that we should fill a ticket like "ST_Summary should report the x and y raster coordinates of the max and the min". So four new columns...

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Bborie Park
> Sent: Monday, June 25, 2012 4:32 PM
> To: postgis-users at postgis.refractions.net
> Subject: Re: [postgis-users] Finding highest cell value in raster using ST_Value
> 
> Egge-Jan,
> 
> That is an intriguing question with no clean/simple solution.  The
> fastest approach may be to call ST_Reclass() to create a 1BB mask based
> upon that value and the pass the resulting raster to
> ST_PixelAsPolygons() which will give you what you want.
> 
> Yes, the above is a round-about way to do this.  This is something I'll
> (ST_PixelofValue?) see about adding for PostGIS 2.1.
> 
> -bborie
> 
> On 06/25/2012 01:16 PM, e.j.h.polle wrote:
> > Hi,
> >
> > OK - with ST_SummaryStats it is easy to retrieve the highest value in the
> > raster, but then I only have this value. Now I want to retrieve
> > (information about) the cell/pixel having this value, to be able to
> > visualize the highest point on the map. My original query (see first post)
> > does give me this information (after 45 seconds...).
> >
> > How would I go about to get hold of the pixel with the highest value,
> > knowing this value?
> >
> > Cheers,
> >
> > Egge-Jan
> >
> > On Sunday, June 24, 2012 8:47:58 PM UTC+1, DavidRA wrote:
> >>
> >> Why don't you use ST_SummaryStats instead ST_Value? That way you can get
> >> easily any basic stat, included the maximum value of the raster. It would
> >> be
> >> something like:
> >>
> >> SELECT (ST_SummaryStats(rast)).max FROM raster_table;
> >>
> >> --
> >> View this message in context:
> >> http://postgis.17.n6.nabble.com/Finding-highest-cell-value-in-raster-using-
> ST-Value-tp4998545p4998554.html
> >> Sent from the PostGIS - User mailing list archive at Nabble.com.
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >
> > On Sunday, June 24, 2012 8:47:58 PM UTC+1, DavidRA wrote:
> >>
> >> Why don't you use ST_SummaryStats instead ST_Value? That way you can get
> >> easily any basic stat, included the maximum value of the raster. It would
> >> be
> >> something like:
> >>
> >> SELECT (ST_SummaryStats(rast)).max FROM raster_table;
> >>
> >> --
> >> View this message in context:
> >> http://postgis.17.n6.nabble.com/Finding-highest-cell-value-in-raster-using-
> ST-Value-tp4998545p4998554.html
> >> Sent from the PostGIS - User mailing list archive at Nabble.com.
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >
> > On Sunday, June 24, 2012 8:47:58 PM UTC+1, DavidRA wrote:
> >>
> >> Why don't you use ST_SummaryStats instead ST_Value? That way you can get
> >> easily any basic stat, included the maximum value of the raster. It would
> >> be
> >> something like:
> >>
> >> SELECT (ST_SummaryStats(rast)).max FROM raster_table;
> >>
> >> --
> >> View this message in context:
> >> http://postgis.17.n6.nabble.com/Finding-highest-cell-value-in-raster-using-
> ST-Value-tp4998545p4998554.html
> >> Sent from the PostGIS - User mailing list archive at Nabble.com.
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> --
> Bborie Park
> Programmer
> Center for Vectorborne Diseases
> UC Davis
> 530-752-8380
> bkpark at ucdavis.edu
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list