Opened 4 years ago

Closed 20 months ago

## #3102 closed defect (fixed)

# v.to.db compactness and fractal dimension

Reported by: | mmetz | Owned by: | |
---|---|---|---|

Priority: | normal | Milestone: | 7.4.2 |

Component: | Vector | Version: | 7.0.1 |

Keywords: | v.to.db, shape metrics | Cc: | |

CPU: | All | Platform: | All |

### Description

If several areas share the same category, v.to.db sums up area sizes and perimeters for all areas with the same category, but for compactness and fractal dimension, the values of the last area processed are used. Instead, for compactness and fractal dimension, area size and perimeter length should be summed up for each category and at the end compactness and fractal dimension should be calculated from the area size and perimeter length sums for each category value.

Further on, compactness aka shape index is normalized to the area size of the most compact shape (a circle), but fractal dimension is not. This normalization is also done by e.g. FRAGSTATS.

The formula for compactness is

perimeter / (2.0 * sqrt(M_PI * area))

which is for given area size and perimeter length of an object the area size of a cirlce with the same perimeter divided by the area size of the object.

The formula for fractal dimension is

2.0 * log(perimeter) / log(area)

but should be

2.0 * log(perimeter / (2.0 * sqrt(M_PI)) / log(area)

which is for given area size and perimeter length of an object the log of the area size of a cirlce with the same perimeter divided by the log of the area size of the object.

Further on, there are problems with using the log() function because log(1) is 0. That means that for area sizes smaller than 1, growing towards 1, the result approaches -infinity and for areas larger than 1 and growing further, the result decreases from +infinity. Thus for area sizes equal 1, the result is undefined, it could be + or -infinity. Results can also be negative or positive, depending on whether perimeter and/or area size are < 1. These problems could be avoided by using log(1 + x) instead of log(x).

The fractal dimension is not only dependent of the shape (cirlce, square, star etc) but also on the size, e.g. larger squares have a smaller fractal dimension than smaller squares. This should be added to the manual to facilitate interpretation of the fractal dimension.

### Change History (8)

### comment:1 Changed 3 years ago by

Milestone: | 7.3.0 → 7.4.0 |
---|

### comment:5 Changed 21 months ago by

Milestone: | 7.4.1 → 7.4.2 |
---|

### comment:7 Changed 20 months ago by

Resolution: | fixed |
---|---|

Status: | closed → reopened |

(reopening the automatic closing, since milestone = 7.4.x)

**Note:**See TracTickets for help on using tickets.

Milestone renamed