Opened 11 years ago

Closed 11 years ago

#2238 closed defect (fixed)

[raster]: Clarify meaning of neighborhood width/height (distance in 2.1)

Reported by: robe Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.0.4
Component: raster Version: master
Keywords: Cc:

Description

I guess I don't use the neighborhood map algebra functions much. Leo asked what our convention is for neighborhood width/height (distance)

is it distance from reference cell or the total width/height that includes the center cell (which would seem to make it always odd)

I realized I embarassingly don't know the answer and just assumed it was radius (distance from center). Our docs don't help much. They are ambiguous.

I always assumed we measured as distance from reference cell so

2,2 —> means a matrix of 5x5 11011 (where 0 is the center cell)

but other stuff I've read seems to contradict that assumption and define it as the total width/height (5x5)

Change History (5)

comment:1 by Bborie Park, 11 years ago

The convention is the number of pixels from the reference cell.

So, specifying ngbwidth = 1 and ngbheight = 2 of ST_MapAlgebraFctNgb() would mean a 3 x 5 neighborhood.

1 1 1
1 1 1
1 0 1
1 1 1
1 1 1

Is this for 2.1 or 2.0? The title seems to indicate 2.1 while the milestone is set for 2.0.4

comment:2 by robe, 11 years ago

I was meaning both. It was unclear for me in both docs. By convention we mark it for the earliest version we plan to change.

Distance seems a clearer concept — but distancex,distancey is absolutely equivalent to ngbwidth, ngbheight (of 2.0) which is what I wanted to clarify. So my assumption is correct on both counts?

comment:3 by robe, 11 years ago

fixed for 2.1.0 at r11177

comment:4 by Bborie Park, 11 years ago

Yes. Your assumption is correct.

comment:5 by robe, 11 years ago

Resolution: fixed
Status: newclosed

clarified for 2.0 at r11178

Note: See TracTickets for help on using tickets.