Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1752 closed enhancement (fixed)

[raster] ST_Neighborhood

Reported by: Bborie Park Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.1.0
Component: raster Version: master
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 (7)

comment:1 by Bborie Park, 12 years ago

Status: newassigned

comment:2 by pracine, 12 years ago

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))

?

comment:3 by Bborie Park, 12 years ago

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.

comment:4 by Bborie Park, 12 years ago

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.

comment:5 by Bborie Park, 12 years ago

Resolution: fixed
Status: assignedclosed

Committed in r9786

comment:6 by Bborie Park, 12 years ago

Keywords: history added
Milestone: PostGIS FuturePostGIS 2.0.1

comment:7 by Bborie Park, 12 years ago

Milestone: PostGIS 2.0.1PostGIS 2.1.0
Note: See TracTickets for help on using tickets.