Angle

View: New views
12 Messages — Rating Filter:   Alert me  

Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list,

Could someone tell me how to get an angle of a linestring feature ?

Regards...

--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias@...
"the worst of democracies is still better than the best of dictatorship"

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Bingo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias Rodrigues da Rocha wrote:
> Hi list,
>
> Could someone tell me how to get an angle of a linestring feature ?
>
> Regards...
>

The azimuth(geometry, geometry) function might be what you are
looking for.
Input geometries are points, so you might use
Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
Linestring.

http://postgis.refractions.net/docs/ch06.html#id2528534

--
Arnaud


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, now I need to get the start and and point of a linestring feature.
Could you tell me please ?

Regards
Ezequias

Arnaud Lesauvage escreveu:

> Ezequias Rodrigues da Rocha wrote:
>> Hi list,
>>
>> Could someone tell me how to get an angle of a linestring feature ?
>>
>> Regards...
>>
>
> The azimuth(geometry, geometry) function might be what you are looking
> for.
> Input geometries are points, so you might use
> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
> Linestring.
>
> http://postgis.refractions.net/docs/ch06.html#id2528534
>
> --
> Arnaud
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias@...
"the worst of democracies is still better than the best of dictatorship"

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Bingo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias Rodrigues da Rocha wrote:

> Ok, now I need to get the start and and point of a linestring feature.
> Could you tell me please ?
>
> Regards
> Ezequias
>
> Arnaud Lesauvage escreveu:
>> Ezequias Rodrigues da Rocha wrote:
>>> Hi list,
>>>
>>> Could someone tell me how to get an angle of a linestring feature ?
>>>
>>> Regards...
>>>
>>
>> The azimuth(geometry, geometry) function might be what you are looking
>> for.
>> Input geometries are points, so you might use
>> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
>> Linestring.
>>
>> http://postgis.refractions.net/docs/ch06.html#id2528534


What do you think these "StartPoint" and "EndPoint" functions do ?
Have you read the documentation at
http://postgis.refractions.net/docs/ ?
All you questions are answered there.


PS : Please, reply below the quotes. Thanks !

--
Arnaud

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Arnaud Lesauvage escreveu:

> Ezequias Rodrigues da Rocha wrote:
>> Ok, now I need to get the start and and point of a linestring
>> feature. Could you tell me please ?
>>
>> Regards
>> Ezequias
>>
>> Arnaud Lesauvage escreveu:
>>> Ezequias Rodrigues da Rocha wrote:
>>>> Hi list,
>>>>
>>>> Could someone tell me how to get an angle of a linestring feature ?
>>>>
>>>> Regards...
>>>>
>>>
>>> The azimuth(geometry, geometry) function might be what you are
>>> looking for.
>>> Input geometries are points, so you might use
>>> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
>>> Linestring.
>>>
>>> http://postgis.refractions.net/docs/ch06.html#id2528534
>
>
> What do you think these "StartPoint" and "EndPoint" functions do ?
> Have you read the documentation at http://postgis.refractions.net/docs/ ?
> All you questions are answered there.
>
>
> PS : Please, reply below the quotes. Thanks !
>
> --
> Arnaud
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
Arnaud (great name. The name of my grandfather),

I tried like this but the result (as you can see now) is too below.

dbpotgis=# SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as
azimuth from mub where gid = 2900;
     azimuth
------------------
 2.17998093202836
(1 row)

dbpotgis=#

The real angle is 143,9 and the function only rerutns 2.17...

Could you tell me what I did wrong ?

Regards ...
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Bingo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias Rodrigues da Rocha wrote:

> Arnaud Lesauvage escreveu:
>> Ezequias Rodrigues da Rocha wrote:
>>> Arnaud Lesauvage escreveu:
>>>> Ezequias Rodrigues da Rocha wrote:
>>>>> Could someone tell me how to get an angle of a linestring feature ?
>>>>>
>>>>> Regards...
>>>>>
>>>>
>>>> The azimuth(geometry, geometry) function might be what you are
>>>> looking for.
>>>> Input geometries are points, so you might use
>>>> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
>>>> Linestring.
>>>>
>>>> http://postgis.refractions.net/docs/ch06.html#id2528534
>>
>>
>> What do you think these "StartPoint" and "EndPoint" functions do ?
>> Have you read the documentation at http://postgis.refractions.net/docs/ ?
>> All you questions are answered there.
> Arnaud (great name. The name of my grandfather),
>
> I tried like this but the result (as you can see now) is too below.
>
> dbpotgis=# SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as
> azimuth from mub where gid = 2900;
>      azimuth
> ------------------
>  2.17998093202836
> (1 row)
>
> dbpotgis=#
>
> The real angle is 143,9 and the function only rerutns 2.17...
>
> Could you tell me what I did wrong ?


Azimtuh returns an angle in radians, you will need to convert that
to degrees.
Then, I *believe* that azimuth is the angle measured from the
North, so if you need an angle mesured form a west-east line you
will have to add 90 degrees to that also.

--
Arnaud


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by marco vieira-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias:
 Look at postgis documentation. azimuth() returns radians, not degrees. You must divide by pi rad and multiply by 180 degrees to obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual calculation using start and end points (make sure you are using the same start and end points).
Regards.
--
Marco Vieira
+55 21 9499-6800
e-mail: maovieira@...
2006/7/6, Ezequias Rodrigues da Rocha <ezequias@...>:


Arnaud Lesauvage escreveu:

> Ezequias Rodrigues da Rocha wrote:
>> Ok, now I need to get the start and and point of a linestring
>> feature. Could you tell me please ?
>>
>> Regards
>> Ezequias
>>
>> Arnaud Lesauvage escreveu:
>>> Ezequias Rodrigues da Rocha wrote:
>>>> Hi list,
>>>>
>>>> Could someone tell me how to get an angle of a linestring feature ?
>>>>
>>>> Regards...
>>>>
>>>
>>> The azimuth(geometry, geometry) function might be what you are
>>> looking for.
>>> Input geometries are points, so you might use
>>> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
>>> Linestring.
>>>
>>> http://postgis.refractions.net/docs/ch06.html#id2528534
>
>
> What do you think these "StartPoint" and "EndPoint" functions do ?
> Have you read the documentation at http://postgis.refractions.net/docs/ ?
> All you questions are answered there.
>
>
> PS : Please, reply below the quotes. Thanks !
>
> --
> Arnaud
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
Arnaud (great name. The name of my grandfather),

I tried like this but the result (as you can see now) is too below.

dbpotgis=# SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as
azimuth from mub where gid = 2900;
     azimuth
------------------
2.17998093202836
(1 row)

dbpotgis=#

The real angle is 143,9 and the function only rerutns 2.17...

Could you tell me what I did wrong ?

Regards ...
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users




_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

marco vieira escreveu:

> Ezequias:
>  Look at postgis documentation. azimuth() returns radians, not
> degrees. You must divide by pi rad and multiply by 180 degrees to
> obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual
> calculation using start and end points (make sure you are using the
> same start and end points).
> Regards.
> --
> Marco Vieira
> +55 21 9499-6800
> e-mail: maovieira@... <mailto:maovieira@...>
> 2006/7/6, Ezequias Rodrigues da Rocha <ezequias@...
> <mailto:ezequias@...>>:
>
>
>
>     Arnaud Lesauvage escreveu:
>     > Ezequias Rodrigues da Rocha wrote:
>     >> Ok, now I need to get the start and and point of a linestring
>     >> feature. Could you tell me please ?
>     >>
>     >> Regards
>     >> Ezequias
>     >>
>     >> Arnaud Lesauvage escreveu:
>     >>> Ezequias Rodrigues da Rocha wrote:
>     >>>> Hi list,
>     >>>>
>     >>>> Could someone tell me how to get an angle of a linestring
>     feature ?
>     >>>>
>     >>>> Regards...
>     >>>>
>     >>>
>     >>> The azimuth(geometry, geometry) function might be what you are
>     >>> looking for.
>     >>> Input geometries are points, so you might use
>     >>> Azimuth(StartPoint(geometry), EndPoint(geometry)) if geometry is a
>     >>> Linestring.
>     >>>
>     >>> http://postgis.refractions.net/docs/ch06.html#id2528534
>     <http://postgis.refractions.net/docs/ch06.html#id2528534>
>     >
>     >
>     > What do you think these "StartPoint" and "EndPoint" functions do ?
>     > Have you read the documentation at
>     http://postgis.refractions.net/docs/
>     <http://postgis.refractions.net/docs/> ?
>     > All you questions are answered there.
>     >
>     >
>     > PS : Please, reply below the quotes. Thanks !
>     >
>     > --
>     > Arnaud
>     >
>     > _______________________________________________
>     > postgis-users mailing list
>     > postgis-users@...
>     <mailto:postgis-users@...>
>     > http://postgis.refractions.net/mailman/listinfo/postgis-users
>     <http://postgis.refractions.net/mailman/listinfo/postgis-users>
>     >
>     Arnaud (great name. The name of my grandfather),
>
>     I tried like this but the result (as you can see now) is too below.
>
>     dbpotgis=# SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as
>     azimuth from mub where gid = 2900;
>          azimuth
>     ------------------
>     2.17998093202836
>     (1 row)
>
>     dbpotgis=#
>
>     The real angle is 143,9 and the function only rerutns 2.17...
>
>     Could you tell me what I did wrong ?
>
>     Regards ...
>     _______________________________________________
>     postgis-users mailing list
>     postgis-users@...
>     <mailto:postgis-users@...>
>     http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>  
Marco,

I did the following:

DesiredDegree = 180 - ColumnInRad /PI * 1 rad

Whre 1 rad = 57.29577951


Some features works someothers dont.
:-) :-(

Regards
Ezequias
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Eduardo Luís Garcia Escovar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias Rodrigues da Rocha escreveu:

> marco vieira escreveu:
>> Ezequias:
>>  Look at postgis documentation. azimuth() returns radians, not
>> degrees. You must divide by pi rad and multiply by 180 degrees to
>> obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual
>> calculation using start and end points (make sure you are using the
>> same start and end points).
>> Regards.
>> --
>> Marco Vieira
>> +55 21 9499-6800
>> e-mail: maovieira@... <mailto:maovieira@...>  
> Marco,
>
> I did the following:
>
> DesiredDegree = 180 - ColumnInRad /PI * 1 rad
>
> Whre 1 rad = 57.29577951
>
>
> Some features works someothers dont.
> :-) :-(
>
> Regards
> Ezequias
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
Ezequias,

You should have done like Marco said:

DesiredDegree = ColumnInRad/pi( )*180

Remember, this result is the azimuth (angle from the north, i.e., from
the y axis, clockwise).

Hope this helps,
Eduardo
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Eduardo Luís Garcia Escovar escreveu:

> Ezequias Rodrigues da Rocha escreveu:
>> marco vieira escreveu:
>>> Ezequias:
>>>  Look at postgis documentation. azimuth() returns radians, not
>>> degrees. You must divide by pi rad and multiply by 180 degrees to
>>> obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual
>>> calculation using start and end points (make sure you are using the
>>> same start and end points).
>>> Regards.
>>> --
>>> Marco Vieira
>>> +55 21 9499-6800
>>> e-mail: maovieira@... <mailto:maovieira@...>  
>> Marco,
>>
>> I did the following:
>>
>> DesiredDegree = 180 - ColumnInRad /PI * 1 rad
>>
>> Whre 1 rad = 57.29577951
>>
>>
>> Some features works someothers dont.
>> :-) :-(
>>
>> Regards
>> Ezequias
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> Ezequias,
>
> You should have done like Marco said:
>
> DesiredDegree = ColumnInRad/pi( )*180
>
> Remember, this result is the azimuth (angle from the north, i.e., from
> the y axis, clockwise).
>
> Hope this helps,
> Eduardo
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
Thank you Eduardo,

Could you see for yourself.

My feature is this one:

MULTILINESTRING ((290635.73828125 9108941.88085938, 290635.94921875
9108941.77929688, 290636.2890625 9108940.7109375, 290636.51953125
9108918.06054688, 290636.509765625 9108917.55078125, 290636.119140625
9108916.06054688, 290635.279296875 9108914.69921875, 290635.146484375
9108914.5703125))


The angle my Desktop GIS application says is (OpenJUMP): *91.76 degrees*
(from up to down)

The Azimuth generated by Postgis is:  3.16325843263936

The angle applying this formula (you suggested):  *181.241357699403 degrees
*

So what is wrong ?


Regards ...

--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias@...
"the worst of democracies is still better than the best of dictatorship"

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Angle

by Eduardo Luís Garcia Escovar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ezequias Rodrigues da Rocha escreveu:

>
>
> Eduardo Luís Garcia Escovar escreveu:
>> Ezequias Rodrigues da Rocha escreveu:
>>> marco vieira escreveu:
>>>> Ezequias:
>>>>  Look at postgis documentation. azimuth() returns radians, not
>>>> degrees. You must divide by pi rad and multiply by 180 degrees to
>>>> obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual
>>>> calculation using start and end points (make sure you are using the
>>>> same start and end points).
>>>> Regards.
>>>> --
>>>> Marco Vieira
>>>> +55 21 9499-6800
>>>> e-mail: maovieira@... <mailto:maovieira@...>  
>>> Marco,
>>>
>>> I did the following:
>>>
>>> DesiredDegree = 180 - ColumnInRad /PI * 1 rad
>>>
>>> Whre 1 rad = 57.29577951
>>>
>>>
>>> Some features works someothers dont.
>>> :-) :-(
>>>
>>> Regards
>>> Ezequias
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@...
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> Ezequias,
>>
>> You should have done like Marco said:
>>
>> DesiredDegree = ColumnInRad/pi( )*180
>>
>> Remember, this result is the azimuth (angle from the north, i.e.,
>> from the y axis, clockwise).
>>
>> Hope this helps,
>> Eduardo
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@...
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> Thank you Eduardo,
>
> Could you see for yourself.
>
> My feature is this one:
>
> MULTILINESTRING ((290635.73828125 9108941.88085938, 290635.94921875
> 9108941.77929688, 290636.2890625 9108940.7109375, 290636.51953125
> 9108918.06054688, 290636.509765625 9108917.55078125, 290636.119140625
> 9108916.06054688, 290635.279296875 9108914.69921875, 290635.146484375
> 9108914.5703125))
>
>
> The angle my Desktop GIS application says is (OpenJUMP): *91.76
> degrees* (from up to down)
>
> The Azimuth generated by Postgis is:  3.16325843263936
>
> The angle applying this formula (you suggested):  *181.241357699403
> degrees
> *
>
> So what is wrong ?
>
>
> Regards ...
Ezequias,

I didn't understand what you meant by "from up to down". Watch the
picture in attached file, so you can see what is the meaning of the
azimuth function result.

Regards
Eduardo


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

azimuth.PNG (6K) Download Attachment

Re: Angle

by Ezequias Rodrigues da Rocha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Now it is working perfect. Thank you Eduardo. Point finish. The X axis
here is not the same azimuth North axis and we only must to make some
changes to see the angle.

Thank you so much one more time.

ps: The image is perfect. You  must post it on the wikipedia too.

Regards
Ezequias

Eduardo Luís Garcia Escovar escreveu:

> Ezequias Rodrigues da Rocha escreveu:
>>
>>
>> Eduardo Luís Garcia Escovar escreveu:
>>> Ezequias Rodrigues da Rocha escreveu:
>>>> marco vieira escreveu:
>>>>> Ezequias:
>>>>>  Look at postgis documentation. azimuth() returns radians, not
>>>>> degrees. You must divide by pi rad and multiply by 180 degrees to
>>>>> obtain 124,9 degrees. Make sure your azimuth is 143,9 by manual
>>>>> calculation using start and end points (make sure you are using
>>>>> the same start and end points).
>>>>> Regards.
>>>>> --
>>>>> Marco Vieira
>>>>> +55 21 9499-6800
>>>>> e-mail: maovieira@... <mailto:maovieira@...>  
>>>> Marco,
>>>>
>>>> I did the following:
>>>>
>>>> DesiredDegree = 180 - ColumnInRad /PI * 1 rad
>>>>
>>>> Whre 1 rad = 57.29577951
>>>>
>>>>
>>>> Some features works someothers dont.
>>>> :-) :-(
>>>>
>>>> Regards
>>>> Ezequias
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users@...
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>> Ezequias,
>>>
>>> You should have done like Marco said:
>>>
>>> DesiredDegree = ColumnInRad/pi( )*180
>>>
>>> Remember, this result is the azimuth (angle from the north, i.e.,
>>> from the y axis, clockwise).
>>>
>>> Hope this helps,
>>> Eduardo
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users@...
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>> Thank you Eduardo,
>>
>> Could you see for yourself.
>>
>> My feature is this one:
>>
>> MULTILINESTRING ((290635.73828125 9108941.88085938, 290635.94921875
>> 9108941.77929688, 290636.2890625 9108940.7109375, 290636.51953125
>> 9108918.06054688, 290636.509765625 9108917.55078125, 290636.119140625
>> 9108916.06054688, 290635.279296875 9108914.69921875, 290635.146484375
>> 9108914.5703125))
>>
>>
>> The angle my Desktop GIS application says is (OpenJUMP): *91.76
>> degrees* (from up to down)
>>
>> The Azimuth generated by Postgis is:  3.16325843263936
>>
>> The angle applying this formula (you suggested):  *181.241357699403
>> degrees
>> *
>>
>> So what is wrong ?
>>
>>
>> Regards ...
> Ezequias,
>
> I didn't understand what you meant by "from up to down". Watch the
> picture in attached file, so you can see what is the meaning of the
> azimuth function result.
>
> Regards
> Eduardo
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@...
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>  

--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias@...
"the worst of democracies is still better than the best of dictatorship"

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users