[postgis-users] Angle
Arnaud Lesauvage
thewild at freesurf.fr
Thu Jul 6 07:28:24 PDT 2006
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
More information about the postgis-users
mailing list