Attribute Fill - Vector to Vector

The Atribute Fill - Vector to Vector  tool is used to extract information of one layer (polygons, lines or points) and assign values to attributes of another layer (for example a cellular space or any other vector layer overlapping it).

The operations described bellow are used to calculate the attributes values considering the spatial relashionship among the geometries of both layers.

Operations are available according to the type of representation and data types of the attributes (Integer, Real, String) and only take place if there is a spatial relation among the geometries of both layers.


Operation Data Type* Polygons Lines Points
Value If only one relationship: "From" attribute type
More than one: I-R-S
X X X
Minimum value I-R-S X X X
Maximum value I-R-S X X X
Mean I-R X X X
Sum of values I-R X X X
Total number of values I-R-S X X X
Total not null values I-R-S X X X
Standard deviation I-R X X X
Variance I-R X X X
Skewness I-R X X X
Kurtosis I-R X X X
Amplitude I-R X X X
Median I-R X X X
Coefficient variation I-R X X X
Mode I-R-S X X X
Class with highest occurrence I-S X X X
Class with highest intersection area I-S X - -
Percent per class I-S X - -
Minimun distance I-R-S X X X
Presence I-R-S X X X
Weighted by area I-R X - -
Weighted sum by area I-R X - -
Percent of each class by area I-S X - -
Percent of total area I-R X - -
* S = String; R = Real; I = Integer.

To ilustrate, check the attributes and its values generated by each operation using the layers below.
    "From Layer": cells of 6000m2 with a string attribute called "class" and a numeric called "col_nro", and its respectives Legends.

     "To Layer":  cells of 24000m2 overlapping cells of 6000m2.
     "Output  Layer": cells of 24000m2 with the new attributes generated
.

"From Layer" (cells of 6000m2) and its legends                                  "To Layer" (cells of 24000m2)
___________________________________________________         _________________________

classes  class_leg   Legend Numeric        cell_output

The attributes names will be composed by <attrName>_<operation>, as informed in the TerraLib.log file generated under user data directory.
However, it is limited to 10 caracteres, so
a numeric suffix is added to avoid duplicated name.

Operations over a string attr called "class"
new attribute attribute value No Value
Value class_valu agua no
Minimum value class_min_ agua no
Maximum value class_max_ reflorestamento no
Total number of values class_tota 16 yes
Total not null values class_to_1 8 no
Class with highest occurrence class_clas floresta no
Class with highest intersection area class_cl_1 floresta no
Percentage of each Class by Area (one per class) class_flor 0.25 no
     : Comment : Divide by "To Layer'" geom area class_mata 0.0625 -
class_agua 0.0625 -
class_refl 0.0625 -
class_desm 0.0625 -
Percentage per Class (one per class) class_flor(1) 0.50 no
      :Comment: it does not use area (presence) class_mata(1) 0.125 -
      : class_agua(1) 0.125 -
      : class_refl(1) 0.125 -
      : calss_desm(1) 0.125 -
Minimum Distance class_min(1) 0.0 yes
Minimum Distance From Centroid class_dis_ 0.0 yes
Presence class_pres 1.0 yes
Percentage of Total Area class_perc 1.0 yes


Operations over a numeric attribute called "col_nro"
 new attribute attribute value No Value
Value col_nro_va 0.0 yes
Minimum value col_nro_mi 0.0 yes
Maximum value col_nro_ma 5.0 yes
Mean col_nro_me 1.5 yes
Sum of Values col_nro_su 24.0 no(?)
Total number of values col_nro_to 16 yes
Total not null values col_nro__1 16
Standard deviation col_nro_st 1.751190
Variance col_nro_2 3.066667
Skewness col_nro_sk 0.638430
Kurtosis col_nro_ku 2.500244
Amplitude col_nro_am 5.0
Median col_nro__3 0.50
Coefficient variation col_nro_co 116.746005/100
Mode col_nro_mo 0
Class with highest occurrence col_nro_cl 3
Class with highest intersection area col_nro__4 3
Percentage of each Class by Area (one per class) col_nro_3 0.25
     col_nro_4 0.0625
col_nro_1 0.0625
col_nro_5 0.0625
col_nro_2 0.0625
Percentage per Class (one per class) col_nro_3 0.50
      :Comment: it does not use area (only presence) col_nro_4 0.125
col_nro_1 0.125
col_nro_5 0.125
col_nro_2 0.125
Minimum Distance col_nro_mi 0.0
Minimum Distance From Centroid  col_nro_di 0.0
Presence col_nro_pr 1
Weighted by Area col_nro_we 1.50
Weighted Sum by Area col_nro__1 24.0
Percentage of Total Area col_nro_ 1

Value

This operation gets the value of "From" layer. If there are more than one intersection, the minimum value is used.

Statistical operations (Minimum value, Maximum value, Mean, etc...)

This operation calculates some statistical operations over the objects involved.

Class with highest occurrence

This operation calculates the amount of times all classes occurs in a relationship and take the highiest occurence. In the example the class with highiest ocurrence is "floresta". It does not take in account area, but occurrence.If there is a tie between two classes, the strategy is to use the minimun value.

Class with highest intersection area

This operation calculates which class is predominant in relation to area (sum of all areas of the same class).

Percent of each class by area

This operation calculates the percentage of each class that intersect the "To" geometry area.  One for each class with the percentage of intersection.

Percent per class

This operation calculates the percentage of class presence. If several small polygons of one class is present in a cell, its percentage will be greather independent of its area. 

Minimum distance (border of "From" layer to border of "To" layer)

This operation calculates the minimum distance of all geometries from "From" layer which do not intercept "To" layer geometries. The distance will be zero if there are intersections. 

Minimum distance to Centroid (border of "From" layer to centroid of "To" layer)

This operation calculates the minimum distance of all geometries from "From" layer which do not intercept "To" layer geometries to the centroid of the "To" layer.

Presence

This operation check whether at least one geometry of "From" layer  intercepts a "To" layer geometry.

Weighted by area

This operation calculates the weighted average by area.
        Sum[(attr_value(n) * IntersectonArea(n))/To_Area(n)] 

Weighted sum by area

This operation calculates the weighted average sum by area.
        Sum[(attr_value(n) * IntersectionArea(n))/FromArea(n)]

Percent of total area

This operation calculates the percentage of class area that intersects the "To" geometry total area.

Using the interface

It is accessed through:

Processing > Attribte Fill > VectorToVector...
  1. "From" layer:  select the layer from where the information will be extracted.
  2. "To" layer:  select the layer that will receive the information processed.
  3. Select attributes...: select the attributes of the "To" layer that will be at the output.
  4. Spatial Relation: choose the spatial relation available.
  5. Output: inform the Output Repository by clicking on:
  6. Operations:  select the attributes versus operation from this table (attr_name: operation).
  7. Click OK to perform the operation or Cancel to close the interface.
IMPORTANTE: The output layer keeps the geometries of the "To Layer" and add  attributes for the operations selected. Operations involving classes can generate more than one attribute.