Ticket #1889 (closed enhancement: fixed)

Opened 11 months ago

Last modified 11 months ago

[raster] ST_PixelOfValue: given a band and value, get the band pixels with that value

Reported by: dustymugs Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.1.0
Component: raster Version: trunk
Keywords: Cc:

Description

As per the discussion in...

 http://postgis.refractions.net/pipermail/postgis-users/2012-June/034611.html

It would be nice to have a function able to return the pixel coordinates of a user-specified value.

ST_PixelofValue(
	rast raster,
	nband integer,
	pixval double precision[],
	exclude_nodata_value DEFAULT true,
	OUT val double precision,
	OUT x integer,
	OUT y integer
) -> setof record

ST_PixelofValue(
	rast raster,
	nband integer,
	pixval double precision,
	exclude_nodata_value DEFAULT true,
	OUT x integer,
	OUT y integer
) -> setof record

Change History

Changed 11 months ago by pracine

I find this is very similar to adding a WHERE clause to ST_PixelAsPoints...

SELECT (gv).geom FROM (SELECT (ST_PixelAsPoints(rast)).geom geom

FROM rast

)

WHERE (gv).val = 1234

ST_PixelofValue might be faster though...

Changed 11 months ago by dustymugs

You're correct. That would be very similar (though I don't see ST_PixelAsPoints() anywhere). ST_PixelofValue should be fast

Changed 11 months ago by dustymugs

  • status changed from new to closed
  • resolution set to fixed

Added in r9987.

Note: See TracTickets for help on using tickets.