Opened 8 years ago

Closed 6 years 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 by martinl, 8 years ago

Milestone: 7.3.07.4.0

Milestone renamed

comment:2 by mlennert, 7 years ago

See also #3419.

comment:3 by neteler, 6 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:4 by martinl, 6 years ago

What is status of this issue?

comment:5 by neteler, 6 years ago

Milestone: 7.4.17.4.2

comment:6 by mmetz, 6 years ago

Resolution: fixed
Status: newclosed

In 72866:

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

comment:7 by neteler, 6 years ago

Resolution: fixed
Status: closedreopened

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

comment:8 by mmetz, 6 years ago

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.