Opened 3 years ago

Closed 17 months ago

#3102 closed defect (fixed)

v.to.db compactness and fractal dimension

Reported by: mmetz Owned by: grass-dev@…
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 martinl

Milestone: 7.3.07.4.0

Milestone renamed

comment:2 Changed 2 years ago by mlennert

See also #3419.

comment:3 Changed 22 months ago by neteler

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:4 Changed 22 months ago by martinl

What is status of this issue?

comment:5 Changed 17 months ago by neteler

Milestone: 7.4.17.4.2

comment:6 Changed 17 months ago by mmetz

Resolution: fixed
Status: newclosed

In 72866:

v.to.db: fix compactness and fractal dimension (fixes #3102)

comment:7 Changed 17 months ago by neteler

Resolution: fixed
Status: closedreopened

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

comment:8 Changed 17 months ago by mmetz

Resolution: fixed
Status: reopenedclosed

In 72869:

v.to.db: fix compactness and fractal dimension (fixes #3102, backport trunk r72866,8)

Note: See TracTickets for help on using tickets.