[GRASS-dev] area measurements

Hello dear devs,

I am wondering if something happened since this 4 year old ticket, where
the question of area measurements was raised :

http://trac.osgeo.org/grass/ticket/975

When I need to get an area on the fly, I run d.measure on a graphic
monitor, but it would be very nice to access this function straightly
from wxGUI. Using 6.4 for my workflow, perhaps I missed something on the
7.0 side ?

Thank you, and best wishes for New Year's Eve :wink:
Vincent.

On Sat, Dec 28, 2013 at 3:28 PM, Vincent Bain <bain@toraval.fr> wrote:

Hello dear devs,

I am wondering if something happened since this 4 year old ticket, where
the question of area measurements was raised :

http://trac.osgeo.org/grass/ticket/975

When I need to get an area on the fly, I run d.measure on a graphic
monitor, but it would be very nice to access this function straightly
from wxGUI. Using 6.4 for my workflow, perhaps I missed something on the
7.0 side ?

In the ticket m.measure is suggested as solution which accepts a
series of coordinates to then perform the calculation:
http://grass.osgeo.org/grass70/manuals/m.measure.html

Perhaps, given that a new tiny digitizer is there for wxGUI-i.class
etc, perhaps this could be used to call m.measure then?

Thank you, and best wishes for New Year's Eve :wink:

Thanks & best wishes from here,
Markus

Hi all,

I added support for area measurement in wxGUI (the same place as measuring distance). You are welcome to test. However, I have a few questions/problems:

I was wondering if module m.measure requires a series of coordinates with or without repeating the first pair of coordinates. This is suggested by the fact that it requires at least 4 points for measuring area. If I suppress this condition and use only 3 points it gives me the right result, too.
This is probably given by the underlying functions G_area_of_polygon, but I haven’t found anything in the documentation. I would be glad if we can write something in the m.measure manual because the user might be surprised not to get area for 3 points.

The second thing is about projection. For this projection:

name=Lambert Conformal Conic
proj=lcc
datum=nad83
a=6378137.0
es=0.006694380022900787
lat_1=34.33333333333334
lat_2=36.16666666666666
lat_0=33.75
lon_0=-79
x_0=609601.2199999997
y_0=0
no_defs=defined
unit=Foot_US
units=Foot_USs
meters=0.3048006096012192

I get nothing from m.measure. I can create a ticket if necessary.

Best,

Anna

···

On Mon, Dec 30, 2013 at 7:50 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Sat, Dec 28, 2013 at 3:28 PM, Vincent Bain <bain@toraval.fr> wrote:

Hello dear devs,

I am wondering if something happened since this 4 year old ticket, where
the question of area measurements was raised :

http://trac.osgeo.org/grass/ticket/975

When I need to get an area on the fly, I run d.measure on a graphic
monitor, but it would be very nice to access this function straightly
from wxGUI. Using 6.4 for my workflow, perhaps I missed something on the
7.0 side ?

In the ticket m.measure is suggested as solution which accepts a
series of coordinates to then perform the calculation:
http://grass.osgeo.org/grass70/manuals/m.measure.html

Perhaps, given that a new tiny digitizer is there for wxGUI-i.class
etc, perhaps this could be used to call m.measure then?

Thank you, and best wishes for New Year’s Eve :wink:

Thanks & best wishes from here,
Markus


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Anna,

I just tested on r58611. Unfortunately it fails :

when prompted to click and drag first segment, it looks like it works
but then it's impossible to click a third point.

I need to kill once m.measure process, then a second m.measure process
initiates, which I have to kill again. After both are killed, I get the
following message on the console :

Measuring area:
Units not recognized, measurement failed.
Area: 0
Units not recognized, measurement failed.
Area: 0

and the display refreshes.

Here's my g.proj -g

name=Lambert Conformal Conic
proj=lcc
ellps=clark80IGN
lat_1=46.8
lat_0=46.8
lon_0=0
k_0=0.99987742
x_0=600000
y_0=2200000
towgs84=-168,-60,320,0,0,0,0
pm=paris
no_defs=defined
nadgrids=ntf_r93.gsb,null
unit=metre
units=metres
meters=1

On the other hand, measuring distances works like a charm...

Best,
Vincent.

Vincent,

On Sun, Jan 5, 2014 at 5:19 AM, Vincent Bain <bain@toraval.fr> wrote:

Hi Anna,

I just tested on r58611. Unfortunately it fails :

could you try m.measure separately? Launch it from gui command line or menu
so that you have the interactive adding coordinates from map display. Could
you post the result of m.measure with and without -g flag?

Thanks,

Anna

when prompted to click and drag first segment, it looks like it works
but then it's impossible to click a third point.

I need to kill once m.measure process, then a second m.measure process
initiates, which I have to kill again. After both are killed, I get the
following message on the console :

> Measuring area:
> Units not recognized, measurement failed.
> Area: 0
> Units not recognized, measurement failed.
> Area: 0

and the display refreshes.

Here's my g.proj -g

name=Lambert Conformal Conic
proj=lcc
ellps=clark80IGN
lat_1=46.8
lat_0=46.8
lon_0=0
k_0=0.99987742
x_0=600000
y_0=2200000
towgs84=-168,-60,320,0,0,0,0
pm=paris
no_defs=defined
nadgrids=ntf_r93.gsb,null
unit=metre
units=metres
meters=1

On the other hand, measuring distances works like a charm...

Best,
Vincent.

Le dimanche 05 janvier 2014 à 08:42 -0500, Anna Petrášová a écrit :

Vincent,

On Sun, Jan 5, 2014 at 5:19 AM, Vincent Bain <bain@toraval.fr> wrote:
        Hi Anna,
        
        I just tested on r58611. Unfortunately it fails :

could you try m.measure separately? Launch it from gui command line or
menu so that you have the interactive adding coordinates from map
display. Could you post the result of m.measure with and without -g
flag?

Yes, here it is with four points describing a 1 km side square :

m.measure
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
Length: 3000.000000 meters
Area: 1000000.000000 square meters

m.measure -g
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
units=meters,square meters
length=3000.000000
area=1000000.000000

Having a closer look at my PROJ_UNITS file, I noticed unit was set to
"metre" and units was set to "metres". I tried to change these values to
"meter" and "meters". And now it works just fine.

I can't say when and how one can tweak this variable.
Do you think this enhancement could be easily backported to 6.4 ?

Yours,
V.

Hi Vincent,

···

On Sun, Jan 5, 2014 at 10:14 AM, Vincent Bain <bain@toraval.fr> wrote:

Le dimanche 05 janvier 2014 à 08:42 -0500, Anna Petrášová a écrit :

Vincent,

On Sun, Jan 5, 2014 at 5:19 AM, Vincent Bain <bain@toraval.fr> wrote:
Hi Anna,

I just tested on r58611. Unfortunately it fails :

could you try m.measure separately? Launch it from gui command line or
menu so that you have the interactive adding coordinates from map
display. Could you post the result of m.measure with and without -g
flag?

Yes, here it is with four points describing a 1 km side square :

m.measure
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
Length: 3000.000000 meters
Area: 1000000.000000 square meters

m.measure -g
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
units=meters,square meters
length=3000.000000
area=1000000.000000

I actually didn’t want you to use the units parameter, this is why you got reasonable outputs. Without it you would probably get segmentation fault. I created a ticket for this:
http://trac.osgeo.org/grass/ticket/2157

Having a closer look at my PROJ_UNITS file, I noticed unit was set to
“metre” and units was set to “metres”. I tried to change these values to
“meter” and “meters”. And now it works just fine.

Yes, that makes sense. I was wondering why do you have metres instead of meters there?

I can’t say when and how one can tweak this variable.
Do you think this enhancement could be easily backported to 6.4 ?

Unfortunately not. One thing is the GUI part which I would have to write again for grass 6 because although it looks the same, the code of wxGUI is quite different. And write it for grass 6 would be more difficult. The other thing is that m.measure is only a grass 7 module so I don’t know which backend should be used for grass 6.

Regards,
Anna

Yours,
V.

Hi Vincent,

···

just FYI, I fixed (and Markus) the problems with units, so you should now be able to use ‘metres’ as well (but in GRASS 7 only).

On Sun, Jan 5, 2014 at 4:05 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

Hi Vincent,

On Sun, Jan 5, 2014 at 10:14 AM, Vincent Bain <bain@toraval.fr> wrote:

Le dimanche 05 janvier 2014 à 08:42 -0500, Anna Petrášová a écrit :

Vincent,

On Sun, Jan 5, 2014 at 5:19 AM, Vincent Bain <bain@toraval.fr> wrote:
Hi Anna,

I just tested on r58611. Unfortunately it fails :

could you try m.measure separately? Launch it from gui command line or
menu so that you have the interactive adding coordinates from map
display. Could you post the result of m.measure with and without -g
flag?

Yes, here it is with four points describing a 1 km side square :

m.measure
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
Length: 3000.000000 meters
Area: 1000000.000000 square meters

m.measure -g
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
units=meters,square meters
length=3000.000000
area=1000000.000000

I actually didn’t want you to use the units parameter, this is why you got reasonable outputs. Without it you would probably get segmentation fault. I created a ticket for this:
http://trac.osgeo.org/grass/ticket/2157

Having a closer look at my PROJ_UNITS file, I noticed unit was set to
“metre” and units was set to “metres”. I tried to change these values to
“meter” and “meters”. And now it works just fine.

Yes, that makes sense. I was wondering why do you have metres instead of meters there?

I can’t say when and how one can tweak this variable.
Do you think this enhancement could be easily backported to 6.4 ?

Unfortunately not. One thing is the GUI part which I would have to write again for grass 6 because although it looks the same, the code of wxGUI is quite different. And write it for grass 6 would be more difficult. The other thing is that m.measure is only a grass 7 module so I don’t know which backend should be used for grass 6.

Regards,
Anna

Yours,
V.

Thank you, Anna :slight_smile:
I just tested - it really works. Also I'm happy to see that event
handling for distance measurement now is in a good shape. Finally both
tools are usable in G7.

Thank you and keep up your good work :slight_smile:
Maris.

2014/1/7 Anna Petrášová <kratochanna@gmail.com>:

Hi Vincent,

just FYI, I fixed (and Markus) the problems with units, so you should now be
able to use 'metres' as well (but in GRASS 7 only).

On Sun, Jan 5, 2014 at 4:05 PM, Anna Petrášová <kratochanna@gmail.com>
wrote:

Hi Vincent,

On Sun, Jan 5, 2014 at 10:14 AM, Vincent Bain <bain@toraval.fr> wrote:

Le dimanche 05 janvier 2014 à 08:42 -0500, Anna Petrášová a écrit :
>
> Vincent,
>
> On Sun, Jan 5, 2014 at 5:19 AM, Vincent Bain <bain@toraval.fr> wrote:
> Hi Anna,
>
> I just tested on r58611. Unfortunately it fails :
>
>
> could you try m.measure separately? Launch it from gui command line or
> menu so that you have the interactive adding coordinates from map
> display. Could you post the result of m.measure with and without -g
> flag?

Yes, here it is with four points describing a 1 km side square :

m.measure
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
Length: 3000.000000 meters
Area: 1000000.000000 square meters

m.measure -g
coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
units=meters
units=meters,square meters
length=3000.000000
area=1000000.000000

I actually didn't want you to use the units parameter, this is why you got
reasonable outputs. Without it you would probably get segmentation fault. I
created a ticket for this:
http://trac.osgeo.org/grass/ticket/2157

Having a closer look at my PROJ_UNITS file, I noticed unit was set to
"metre" and units was set to "metres". I tried to change these values to
"meter" and "meters". And now it works just fine.

Yes, that makes sense. I was wondering why do you have metres instead of
meters there?

I can't say when and how one can tweak this variable.
Do you think this enhancement could be easily backported to 6.4 ?

Unfortunately not. One thing is the GUI part which I would have to write
again for grass 6 because although it looks the same, the code of wxGUI is
quite different. And write it for grass 6 would be more difficult. The other
thing is that m.measure is only a grass 7 module so I don't know which
backend should be used for grass 6.

Regards,
Anna

Yours,
V.

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev