Opened 11 years ago

Last modified 7 years ago

#2629 new enhancement

[raster] Masks as POI lists

Reported by: nclay Owned by: Bborie Park
Priority: medium Milestone: PostGIS Fund Me
Component: raster Version: master
Keywords: Cc:

Description

Mask internally to MapAlgebra should not be represented by 2D arrays as that leads to an iteration over every element. When in the sparse case of a mask it would be much more efficient to set the deterministic values then iterate over the non-deterministic values and setting their appropriate return value. Thus minimizing the number of iterations MapAlgebra does for each mask operation.

 mask = [
 3.14,0,0,0,3.14
  0,0,0,0,0
 3.14,0,0,0,3.14
 ]
 poi = [3,2]


 poiList = [ [0,0,3.l4],[0,4,3.14],[2,0,3.14],[2,4,3.14]]
 eg.
 poilist = [[x,y,mValue],...,[poix,poiy,1]]

However, we must be careful not to detrimentally affect the execution of dense masks. The code implementing this should take into account the sparseness of an mask and take appropriate action.

eg. With a dense mask it would be best not to preset any of the values in the returning array as this would just waist execution time. However with a sparse mask the opposite is true. There for a separate utility function should be created to encapsulate the logic of determining how best to represent the mask as a poi list and the presetting of deterministic values.

rt_util_mask_to_poi(  .... )

Also it may be beneficial to a user to have the ability to hint MapAlgebra that a mask is sparse through a optional hint in the Mask Object.

sparse = BOOLEAN

When NULL a best effort determination is made by:

rt_util_mask_to_poi( ... )

Also, this will require a new rt_pixel function as well as a new rt_mask representation:

rt_pixel_set_poi_to_array( ... )

Change History (1)

comment:1 by robe, 7 years ago

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.