[postgis-tickets] [PostGIS] #2617: [raster] Enhanced mask object for raster map algebra

PostGIS trac at osgeo.org
Wed Jan 29 20:02:11 PST 2014


#2617: [raster] Enhanced mask object for raster map algebra
-------------------------+--------------------------------------------------
 Reporter:  dustymugs    |       Owner:  dustymugs     
     Type:  enhancement  |      Status:  new           
 Priority:  medium       |   Milestone:  PostGIS Future
Component:  raster       |     Version:  trunk         
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by dustymugs):

 Hmmm... Maybe I should explain what I'm thinking...

 1. I don't consider the following mask to be invalid.

 {{{
 mask = [
 1,1,1,1
 1,1,1,1
 1,1,1,1
 ]

 poi = [2,2]
 }}}

 Matter of fact, I think it's as valid as an odd-dimensioned array (both
 dimensions have odd-valued length). It's just that we have been making an
 assumption about the POI with odd-dimensioned arrays.

 2. I don't think we should be making an even-dimensioned array (at least
 one dimension has even-valued length) valid by adding additional elements.
 The mask provided as input is the mask carried throughout the code to the
 callback function. I expect that users providing even-dimensioned masks
 expect their callback to receive value arrays with matching dimensions.

 3. To make it easier for mask generating functions (such as the wedge) and
 ease the number of input parameters to ST_MapAlgebra, we should consider
 creating a composite type...

 mapalgebra_mask = (
   mask = ARRAY[]::double precision,
   weighted = BOOLEAN,
   poi = ARRAY[]::integer
 )

 4. Ensuring the passage of any dimension array (matching the dimensions of
 the mask) to the callback would require passing the POI coordinates of the
 array. This could be done by overloading the ''pos'' array provided to
 each call of the callback function.

 I hope that explains my thoughts and thought processes.

 Also... one comment...

 "As for the mixed array problem, when we currently use a non-weighted
 array we really are wanting to use and Integer but are forced for the same
 reason to cast it to a double precision, why could we not have the mask
 array be text and at the C level cast it to the appropriate type or set
 the appropriate bits?"

 The non-weighted integer array is forced to be double precision because
 that is what is the function signature expects. You can specify the
 parameter as being of ''anyarray'' and then filter out permitted types in
 switch at line 646 of rtpg_mapalgebra.c.

 [http://www.postgresql.org/docs/9.3/static/datatype-pseudo.html]

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2617#comment:4>
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