[postgis-tickets] [PostGIS] #3318: ST_MapAlgebra with mask seems to hard-code distance 1 instead of inferring distance from mask matrix

PostGIS trac at osgeo.org
Mon Oct 5 22:03:46 PDT 2015


#3318: ST_MapAlgebra with mask seems to hard-code distance 1 instead of inferring
distance from mask matrix
----------------------+---------------------------
  Reporter:  robe     |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 2.3.0
 Component:  postgis  |    Version:  trunk
Resolution:           |   Keywords:
----------------------+---------------------------
Description changed by robe:

Old description:

> I've moved this from the now closed mask documentation #2603 to here
>

> {{{
> 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.
>
> ----

New description:

 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.

 ----

--

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3318#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list