[GRASS5] v.to.db 2 new features compactness and perimeter

Hi!

I fixed my fix for supporting compactness in v.to.db. I also added
support for perimeter option which calculates the perimeter of an area.
Compactness is calculated by doing:

compactness = perimeter / 2 * sqrt(M_PI * area)

which gives a circle the value 1 and all other shapes have a larger value.

Please have a look at my patch, and LMK if you think something is
strange or out right wrong. I have tested these new options a bit, but I
haven't really tested them on weird / broken material. I have also not
tried to calculate the perimeter or compactness of lines. (;

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

(attachments)

v.to.db.wolf.patch (6.45 KB)

I messed up the previous patch...

Here is a new one!

--Wolf

On 03/11/05 18:27, Wolf Bergenheim wrote:

Hi!

I fixed my fix for supporting compactness in v.to.db. I also added
support for perimeter option which calculates the perimeter of an area.
Compactness is calculated by doing:

compactness = perimeter / 2 * sqrt(M_PI * area)

which gives a circle the value 1 and all other shapes have a larger value.

Please have a look at my patch, and LMK if you think something is
strange or out right wrong. I have tested these new options a bit, but I
haven't really tested them on weird / broken material. I have also not
tried to calculate the perimeter or compactness of lines. (;

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

(attachments)

v.to.db.wolf.patch (6.46 KB)

Hi,

I have uploaded Wolfs additions to v.to.db into 6.1-CVS.
Thanks, Wolf!

Markus

On Thu, Nov 03, 2005 at 06:58:35PM +0200, Wolf Bergenheim wrote:

I messed up the previous patch...

Here is a new one!

--Wolf

On 03/11/05 18:27, Wolf Bergenheim wrote:
> Hi!
>
> I fixed my fix for supporting compactness in v.to.db. I also added
> support for perimeter option which calculates the perimeter of an area.
> Compactness is calculated by doing:
>
> compactness = perimeter / 2 * sqrt(M_PI * area)
>
> which gives a circle the value 1 and all other shapes have a larger value.
>
> Please have a look at my patch, and LMK if you think something is
> strange or out right wrong. I have tested these new options a bit, but I
> haven't really tested them on weird / broken material. I have also not
> tried to calculate the perimeter or compactness of lines. (;
>
> --Wolf
>

--

<:3 )---- Wolf Bergenheim ----( 8:>

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

> > I fixed my fix for supporting compactness in v.to.db. I also added
> > support for perimeter option which calculates the perimeter of an
> > area. Compactness is calculated by doing:

should we add a warning to the help page about the fractal depth
problem? We wouldn't want people to trust the answers in error if they
start comparing different datasets. Maybe that is what compactness is
partly used as a measure of?

Hamish

On 11/10/05, Wolf Bergenheim <wolf@bergenheim.net> wrote:

Heh. defenately not... I use Vect_line_length() to calculate the length.
perhaps the the fix should go in here? perhaps an additional parameter
or a new fun Vect_line_length_meters(). I guess that the area is ok? or
does it have a unit of square degrees? (;

There is Vect_line_geodesic_length but it should only be used with -g flag.

Radim

Radim Blazek wrote:

On 11/10/05, Wolf Bergenheim <wolf@bergenheim.net> wrote:

Heh. defenately not... I use Vect_line_length() to calculate the length.
perhaps the the fix should go in here? perhaps an additional parameter
or a new fun Vect_line_length_meters(). I guess that the area is ok? or
does it have a unit of square degrees? (;

There is Vect_line_geodesic_length but it should only be used with -g flag.

How about calculating the distance normally (the circumference, and then converting the angular distance to metric, by using:
distance in meters = angle * pi * radius (which is what? 6365 km? Is there any way of getting the radius of the projection?)

How can I deterimin if the projection is LL?

--W

--

<:3 )---- Wolf Bergenheim ----( 8:>

Wolf Bergenheim wrote:

Radim Blazek wrote:

On 11/10/05, Wolf Bergenheim <wolf@bergenheim.net> wrote:

Heh. defenately not... I use Vect_line_length() to calculate the length.
perhaps the the fix should go in here? perhaps an additional parameter
or a new fun Vect_line_length_meters(). I guess that the area is ok? or
does it have a unit of square degrees? (;

There is Vect_line_geodesic_length but it should only be used with -g flag.

How about calculating the distance normally (the circumference, and then converting the angular distance to metric, by using:
distance in meters = angle * pi * radius (which is what? 6365 km? Is there any way of getting the radius of the projection?)

Umm I meant to write:
length = (angle_length/360)*2*M_PI*radius;

How can I deterimin if the projection is LL?

--W

--

<:3 )---- Wolf Bergenheim ----( 8:>