azimuth of lines with v.to.db?

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

azimuth of lines with v.to.db?

Carlos Henrique Grohmann de Carvalho-2
I think I already asked this, but without much success, so here is:
can I use v.to.db to get the azimuth of a line? I am thinking in
lineament analysis, so it's a simple line, just two end vertices.

thanks

Carlos

--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

HamishB
Carlos wrote:
> I think I already asked this, but without much success, so here is:
> can I use v.to.db to get the azimuth of a line? I am thinking in
> lineament analysis, so it's a simple line, just two end vertices.

not directly, but you could use v.to.db to get line start and end points, then
calculate the angle by hand. Or you could copy the v.to.db slope option and
make a new azimuth option from that.  It will not be very useful for lat/lon.


Hamish

ps- I once did the same for r.los



       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Dylan Beaudette-2
In reply to this post by Carlos Henrique Grohmann de Carvalho-2
On Saturday 13 October 2007, Carlos "Guâno" Grohmann wrote:
> I think I already asked this, but without much success, so here is:
> can I use v.to.db to get the azimuth of a line? I am thinking in
> lineament analysis, so it's a simple line, just two end vertices.
>
> thanks
>
> Carlos


Can you calculate it from the end points ?

Like this:

http://casoilresource.lawr.ucdavis.edu/drupal/node/468


.... except that the calculation I am doing is in R. atan2() should exist in
the c library, so adding it to GRASS should be a small effort.


Dylan

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Maciej Sieczka - old
In reply to this post by Carlos Henrique Grohmann de Carvalho-2
Carlos "Guâno" Grohmann wrote:
> I think I already asked this, but without much success, so here is:
> can I use v.to.db to get the azimuth of a line? I am thinking in
> lineament analysis, so it's a simple line, just two end vertices.

Maybe v.distance opt=to_angle? I'm saying "maybe", because
I'm not sure if I understand the description:

"to_angle: angle of linear feature in nearest point,
counterclockwise from positive x axis, in radians, which is
between -PI and PI inclusive"

Anybody knows what is "angle of linear feature in nearest
point" supposed to mean?

BTW - another thing I don't understand in v.distance is the
to_along option: "to_along: distance to the nearest point on
'from' feature along linear feature". Anybody knows if the
"linear feature" is supposed to be present in vector "from"
or vector "to"?

Maciek

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Carlos Henrique Grohmann de Carvalho-2
In reply to this post by Dylan Beaudette-2
This is almost what I need. I need the results to be in range 0-360,
from North. So I can get a rose diagram, with petals weighted
according to azimuth frequency or to azimuth lenght, like the
attachment.

cheers

Carlos



On 10/14/07, Dylan Beaudette <[hidden email]> wrote:

> On Saturday 13 October 2007, Carlos "Guâno" Grohmann wrote:
> > I think I already asked this, but without much success, so here is:
> > can I use v.to.db to get the azimuth of a line? I am thinking in
> > lineament analysis, so it's a simple line, just two end vertices.
> >
> > thanks
> >
> > Carlos
>
>
> Can you calculate it from the end points ?
>
> Like this:
>
> http://casoilresource.lawr.ucdavis.edu/drupal/node/468
>
>
> .... except that the calculation I am doing is in R. atan2() should exist in
> the c library, so adding it to GRASS should be a small effort.
>
>
> Dylan
>
> --
> Dylan Beaudette
> Soil Resource Laboratory
> http://casoilresource.lawr.ucdavis.edu/
> University of California at Davis
> 530.754.7341
>

--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser

rose.jpg (77K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

HamishB
Carlos wrote:
> This is almost what I need. I need the results to be in range 0-360,
> from North. So I can get a rose diagram, with petals weighted
> according to azimuth frequency or to azimuth lenght, like the
> attachment.

convert CCW-from-east to CW-from-north with 90-theta


Hamish




      ____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
http://tv.yahoo.com/collections/3658 

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

rgreenwood
In reply to this post by Carlos Henrique Grohmann de Carvalho-2
On 10/14/07, Carlos Guâno Grohmann <[hidden email]> wrote:
> This is almost what I need. I need the results to be in range 0-360,
> from North. So I can get a rose diagram, with petals weighted
> according to azimuth frequency or to azimuth lenght, like the
> attachment.

Here is a handy formula to get from mathematical "M" angles to
geodetic "G" angles. Mathematical angles are where 0 is the X axis and
the increase counter-clockwise, and geodetic angles begin on the Y
axis and increase clockwise. The formula is in degrees. The formula is
handy because it does it in one step without if/then conditionals.

   G = (450-M) - int( (450-M) / 360) * 360

HTH,
Rich

--
Richard Greenwood
[hidden email]
www.greenwoodmap.com

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Maciej Sieczka - old
In reply to this post by Carlos Henrique Grohmann de Carvalho-2
Carlos "Guâno" Grohmann wrote:
> This is almost what I need. I need the results to be in range 0-360,
> from North. So I can get a rose diagram, with petals weighted
> according to azimuth frequency or to azimuth lenght, like the
> attachment.

I've just remember PROJ.4's geod [1]. Example:

$ echo "50N 19E 51N 20E" | geod -I +ellps=WGS84 +units=m
32d8'43.417"    -147d4'58.6"    131935.963

The 1st 2 numbers are azimuth from the 1st to 2nd point and
back, respectively, 3rd is the distance between them.

[1]http://proj.maptools.org/man_geod.html

Maciek

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Carlos Henrique Grohmann de Carvalho-2
OK, I am trying to get these thing working with db.execute.

although these work:
> echo "UPDATE Lineam_isobase SET dx=end_x-start_x" | db.execute
> echo "UPDATE Lineam_isobase SET dy=end_y-start_y" | db.execute

this doesn't:

> echo "UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)" | db.execute
DBMI-DBF driver error:
SQL parser error:
in statement:
UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)

Error in db_execute_immediate()

ERROR: Error while executing: 'UPDATE Lineam_isobase SET
       ang_rad=atan2(dx,dy)
       '
>

thoughts?

cheers

Carlos


On 10/18/07, Maciej Sieczka <[hidden email]> wrote:

> Carlos "Guâno" Grohmann wrote:
> > This is almost what I need. I need the results to be in range 0-360,
> > from North. So I can get a rose diagram, with petals weighted
> > according to azimuth frequency or to azimuth lenght, like the
> > attachment.
>
> I've just remember PROJ.4's geod [1]. Example:
>
> $ echo "50N 19E 51N 20E" | geod -I +ellps=WGS84 +units=m
> 32d8'43.417"    -147d4'58.6"    131935.963
>
> The 1st 2 numbers are azimuth from the 1st to 2nd point and
> back, respectively, 3rd is the distance between them.
>
> [1]http://proj.maptools.org/man_geod.html
>
> Maciek
>


--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Moritz Lennert
On 18/10/07 13:17, Carlos "Guâno" Grohmann wrote:

> OK, I am trying to get these thing working with db.execute.
>
> although these work:
>> echo "UPDATE Lineam_isobase SET dx=end_x-start_x" | db.execute
>> echo "UPDATE Lineam_isobase SET dy=end_y-start_y" | db.execute
>
> this doesn't:
>
>> echo "UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)" | db.execute
> DBMI-DBF driver error:
> SQL parser error:
> in statement:
> UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)
>
> Error in db_execute_immediate()
>
> ERROR: Error while executing: 'UPDATE Lineam_isobase SET
>        ang_rad=atan2(dx,dy)
>        '
>
> thoughts?

Which database backend are you using ?

Try running after setting 'g.gisenv set=DEBUG=3'.

Moritz

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Martin Landa
In reply to this post by Carlos Henrique Grohmann de Carvalho-2
Hi,

2007/10/18, Carlos Guâno Grohmann <[hidden email]>:

> OK, I am trying to get these thing working with db.execute.
>
> although these work:
> > echo "UPDATE Lineam_isobase SET dx=end_x-start_x" | db.execute
> > echo "UPDATE Lineam_isobase SET dy=end_y-start_y" | db.execute
>
> this doesn't:
>
> > echo "UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)" | db.execute
> DBMI-DBF driver error:
> SQL parser error:
> in statement:
> UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)
>
> Error in db_execute_immediate()
>
> ERROR: Error while executing: 'UPDATE Lineam_isobase SET
>        ang_rad=atan2(dx,dy)
>        '

Use instead of DBF e.g. pg driver, atan2() is not supported by DBF driver.

Martin

--
Martin Landa <[hidden email]> * http://gama.fsv.cvut.cz/~landa *

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Moritz Lennert
In reply to this post by Moritz Lennert
On 18/10/07 14:41, Moritz Lennert wrote:

> On 18/10/07 13:17, Carlos "Guâno" Grohmann wrote:
>> OK, I am trying to get these thing working with db.execute.
>>
>> although these work:
>>> echo "UPDATE Lineam_isobase SET dx=end_x-start_x" | db.execute
>>> echo "UPDATE Lineam_isobase SET dy=end_y-start_y" | db.execute
>>
>> this doesn't:
>>
>>> echo "UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)" | db.execute
>> DBMI-DBF driver error:
>> SQL parser error:
>> in statement:
>> UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)
>>
>> Error in db_execute_immediate()
>>
>> ERROR: Error while executing: 'UPDATE Lineam_isobase SET
>>        ang_rad=atan2(dx,dy)
>>        '
>>
>> thoughts?
>
> Which database backend are you using ?

Sorry, just saw that the information is above (DBMI-DBF): don't think
that the dbf driver supports atan2(). Try with postgresql.

Moritz

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

HamishB
In reply to this post by Martin Landa
Carlos wrote:

> > this doesn't:
> >
> > > echo "UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)" | db.execute
> > DBMI-DBF driver error:
> > SQL parser error:
> > in statement:
> > UPDATE Lineam_isobase SET ang_rad=atan2(dx,dy)
> >
> > Error in db_execute_immediate()
> >
> > ERROR: Error while executing: 'UPDATE Lineam_isobase SET
> >        ang_rad=atan2(dx,dy)

Martin wrote:
> Use instead of DBF e.g. pg driver, atan2() is not supported by DBF driver.

could you get the values of dx,dy to the shell with (v.)db.select then use awk
to do the math and send the result to db.execute?

Other DBs (SQLite, MySQL, Postgres,..) should support it directly.


Hamish


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 

_______________________________________________
grassuser mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/grassuser
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Maris Nartiss
Hello all.
I also needed to do some lineament orientation analysis and to do so I
modified v.to.db [1]. Now it supports calculating line azimuths as CW
direction from line start point to line endpoint.

Usage example:
v.to.db map=lineaments type=line option=azimuth units=degrees
columns=orientation

svn up Your develbranch6 and test it :)

Maris.

1. http://trac.osgeo.org/grass/changeset/36528
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Martin Landa
Hi,

2009/3/30 Maris Nartiss <[hidden email]>:

> I also needed to do some lineament orientation analysis and to do so I
> modified v.to.db [1]. Now it supports calculating line azimuths as CW
> direction from line start point to line endpoint.
>
> Usage example:
> v.to.db map=lineaments type=line option=azimuth units=degrees
> columns=orientation
>
> svn up Your develbranch6 and test it :)

any reason why not to commit also to trunk?

M.

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Maris Nartiss
Yes.
I have no space to checkout GRASS 7 and thus can't test those changes
under GRASS 7. Still I hope to get my new Dell up and running after
four months of trying to get away from memory problems. Then I will
have enough space to work on more than one branch...

Maris.

2009/3/30, Martin Landa <[hidden email]>:
> Hi,
>

>
> any reason why not to commit also to trunk?
>
> M.
>
> --
> Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Martin Landa
Hi,

2009/3/30 Maris Nartiss <[hidden email]>:

> I have no space to checkout GRASS 7 and thus can't test those changes
> under GRASS 7. Still I hope to get my new Dell up and running after
> four months of trying to get away from memory problems. Then I will
> have enough space to work on more than one branch...

are you tracking which patches will go to trunk or I can commit this
path to trunk?

M.

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Markus Neteler
In reply to this post by Maris Nartiss
Maris,

I have merged it into GRASS 7.

Markus

On Mon, Mar 30, 2009 at 3:30 PM, Maris Nartiss <[hidden email]> wrote:

> Yes.
> I have no space to checkout GRASS 7 and thus can't test those changes
> under GRASS 7. Still I hope to get my new Dell up and running after
> four months of trying to get away from memory problems. Then I will
> have enough space to work on more than one branch...
>
> Maris.
>
> 2009/3/30, Martin Landa <[hidden email]>:
>> Hi,
>>
>
>>
>> any reason why not to commit also to trunk?
>>
>> M.
>>
>> --
>> Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
>>
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Carlos Henrique Grohmann de Carvalho-2
In reply to this post by Maris Nartiss
Hello.

I did a full up of my develbranch but couldn't use  the azimuth option:

 > v.to.db map=lineamentos type=line option=azimuth units=degrees
columns=azimute

ERROR: value <azimuth> out of range for parameter <option>
       Legal range:
cat,area,compact,fd,perimeter,length,count,coor,start,end,sides,query,slope,sinuous

ERROR: value <degrees> out of range for parameter <units>
       Legal range: mi,miles,f,feet,me,meters,k,kilometers,a,acres,h,hectares


cheers


carlos





On Mon, Mar 30, 2009 at 09:36, Maris Nartiss <[hidden email]> wrote:

> Hello all.
> I also needed to do some lineament orientation analysis and to do so I
> modified v.to.db [1]. Now it supports calculating line azimuths as CW
> direction from line start point to line endpoint.
>
> Usage example:
> v.to.db map=lineaments type=line option=azimuth units=degrees
> columns=orientation
>
> svn up Your develbranch6 and test it :)
>
> Maris.
>
> 1. http://trac.osgeo.org/grass/changeset/36528
>



--
Carlos Henrique Grohmann - Geologist D.Sc.
a.k.a. Guano - Linux User #89721
ResearcherID: A-9030-2008
carlos dot grohmann at gmail dot com
http://www.igc.usp.br/pessoais/guano/
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can’t stop the signal.
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: azimuth of lines with v.to.db?

Maris Nartiss
Hello Carlos,
svn up
cd vector/v.to.db
make clean && make

It's in develbranch_6 r36528 [1]

Maris.

1. http://trac.osgeo.org/grass/changeset/36528
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
12