Opened 13 years ago

Closed 13 years ago

#1889 closed enhancement (fixed)

[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: master
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 (3)

comment:1 by pracine, 13 years ago

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…

comment:2 by dustymugs, 13 years ago

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

comment:3 by dustymugs, 13 years ago

Resolution: fixed
Status: newclosed

Added in r9987.

Note: See TracTickets for help on using tickets.