Ticket #1752 (closed enhancement: fixed)

Opened 14 months ago

Last modified 12 months ago

[raster] ST_Neighborhood

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

Description

Along with ST_NearestValue(), a related function is to get the all pixels within N pixel distance from a specific pixel (excluding the specific pixel). The function returns a set of records (x, y, pixel value) that can used for additional processing...

ST_Neighborhood(
	rast raster, band integer,
	ix integer, iy integer,
	distance integer,
	exclude_nodata_value boolean DEFAULT TRUE,
	OUT x integer, OUT y integer,
	OUT val double precision
) -> SETOF record

distance: value greater than zero denoting the size of the neighborhood around the specified pixel. So a value of 4 would be all pixels within the box made by 4 pixels to the left of, 4 pixels to the right of, 4 pixels above and 4 pixels below the specific pixel

ST_Neighborhood(
	rast raster,
	ix integer, iy integer,
	distance integer,
	exclude_nodata_value boolean DEFAULT TRUE,
	OUT x integer, OUT y integer,
	OUT val double precision
) -> SETOF record
ST_Neighborhood(
	rast raster, band integer,
	pt geometry,
	distance integer,
	exclude_nodata_value boolean DEFAULT TRUE,
	OUT x integer, OUT y integer,
	OUT val double precision
) -> SETOF record
ST_Neighborhood(
	rast raster,
	pt geometry,
	distance integer,
	exclude_nodata_value boolean DEFAULT TRUE,
	OUT x integer, OUT y integer,
	OUT val double precision
) -> SETOF record

Change History

Changed 14 months ago by dustymugs

  • status changed from new to assigned

Changed 14 months ago by pracine

Could the result be formatted properly so that we can pass it directly to one of the st_...4ma already existing functions?

SELECT ST_Max4Ma(ST_Neighborhood(rast, 1, 3.14))

?

Changed 14 months ago by dustymugs

Would the following work?

SELECT ST_Max4Ma((ST_Neighborhood(rast, 1, 3.14)).val)

The format of returning a set of (x, y, val) is so that someone could go nuts with the results, such as weighted averages based upon distance.

Changed 14 months ago by dustymugs

After looking at the ST_xx4ma functions, I adjust the output of the ST_Neighborhood to double precision[][] since I haven't started using ST_Neighborhood for my in-house needs.

Changed 12 months ago by dustymugs

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

Committed in r9786

Changed 12 months ago by dustymugs

  • keywords history added
  • milestone changed from PostGIS Future to PostGIS 2.0.1

Changed 12 months ago by dustymugs

  • milestone changed from PostGIS 2.0.1 to PostGIS 2.1.0
Note: See TracTickets for help on using tickets.