[postgis-users] My crusade to get the real angle

Nicolas Ribot nicky666 at gmail.com
Mon Jul 10 05:15:44 PDT 2006


>
>  Hi list,
>
>  I am still on my crusade to my real angle (not azimuth).  Even with the
> mapserver doesen't helping me with labels I am sill trying to retrieve the
> real angle of a linestring.
>
>  As you should know I have the azimuth of a set of linestrings and after a
> radians to degree conversion I noticed that the XY system is quite different
> from the Azimuth system and I need to do some conversions for each quadrant.
>
>  So my question is: How do I apply a if statement on Postgis/Postgresql ? I
> know is is not a Postgis question but I think you could help me.
>
>  I am trying to run this command line on psql:
>
>  select angulo from mub;
>  IF ANGLE >= 0 AND ANGLE <=90  THEN
>   UPDATE TABLE MUB SET ANGLE = 90 – ANGLE
>  END IF;
>
>  But it does not work. Any help will be welcomed.
>

Hi,
You may try to write a custom function (in Pl/PGSQL or another
language supported by postgis).
See the Postgresql documentation, "server programming -> Chapter 36.
PL/pgSQL - SQL Procedural Language"
You will be able to use control and loop structures.

Nicolas



More information about the postgis-users mailing list