Opened 2 years ago

Last modified 4 months ago

#3318 assigned defect

ST_MapAlgebra with mask seems to hard-code distance 1 instead of inferring distance from mask matrix

Reported by: robe Owned by: dustymugs
Priority: medium Milestone: PostGIS Fund Me
Component: raster Version: trunk
Keywords: Cc:

Description (last modified by robe)

I've moved this from the now closed mask documentation #2603 to here, I'm still having issue with this even as of r14198 even though dusty has made some changes.

DROP TABLE IF EXISTS shapes;
CREATE TABLE shapes(rid integer, rast raster);  

INSERT INTO shapes(rid,rast)
VALUES ( 1, ST_AsRaster(
		ST_Buffer(
			ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'), 10,'join=bevel'), 
			200,200,ARRAY['8BUI'], ARRAY[118], ARRAY[0]) );

 SELECT st_mapalgebra(rast,1,'st_mean4ma(double precision[], int[], text[])'::regprocedure,'{{1,0,1,1,1}, {1,0,1,1,1}, {1,0,1,1,1}, {1,0,1,1,1}, {1,0,1,1,1}}'::double precision[],false)
FROM shapes;

Gives error:

ERROR:  rt_pixel_set_array: mask dimensions 5 x 5 do not match given dims 3 x 3

It's my understanding based on dusty's comments that the neighborhood size should be inferred from the mask size, so there seems to me something wrong here.

Bborie's comments copied from other ticket


Distance is two pixels left, right, up, down from the pixel of interest...

2 2 2 2 2
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2

So the distance x/y are correct. As for that error message, I'll need to dig.


Change History (13)

comment:1 Changed 2 years ago by robe

Description: modified (diff)

comment:2 Changed 2 years ago by robe

Component: postgisraster
Owner: changed from pramsey to dustymugs

comment:3 Changed 2 years ago by robe

Milestone: PostGIS 2.3.0PostGIS 2.2.1

comment:4 Changed 2 years ago by dustymugs

Status: newassigned

comment:5 Changed 2 years ago by dustymugs

Priority: mediumcritical

comment:6 Changed 2 years ago by robe

Milestone: PostGIS 2.2.1PostGIS 2.3.0

Bborie,

I'm guessing you won't have time to look at this within the next day or so, so pushing to 2.3. If you do feel free to push back. I'll push to 2.2.2 after release.

comment:7 Changed 2 years ago by dustymugs

Wow I forgot about this... I'll take a look tonight.

comment:8 Changed 2 years ago by robe

Milestone: PostGIS 2.3.0PostGIS 2.2.1

okay I'll switch back then. Hurry Hurry PostgreSQL 9.5.0 is already been stamped.

comment:9 Changed 2 years ago by robe

Milestone: PostGIS 2.2.1PostGIS 2.2.2

comment:10 Changed 21 months ago by pramsey

Milestone: PostGIS 2.2.2PostGIS 2.2.3

comment:11 Changed 15 months ago by robe

Milestone: PostGIS 2.2.3PostGIS 2.4.0

comment:12 Changed 4 months ago by robe

Milestone: PostGIS 2.4.0PostGIS Future
Priority: criticalmedium

comment:13 Changed 4 months ago by robe

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.