Changes between Version 35 and Version 36 of UsersWikiplpgsqlfunctions


Ignore:
Timestamp:
08/05/20 15:52:51 (4 years ago)
Author:
mdavis
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiplpgsqlfunctions

    v35 v36  
    33 
    44This is an area to put utility functions or wrappers around PostGIS.
    5 
    6 == Rotate Geometry around a Point ==
    7 {{{
    8 #!sql
    9 CREATE OR REPLACE FUNCTION RotateAtPoint(
    10   geom geometry, pt_x double precision, pt_y double precision, angle double precision)
    11  RETURNS geometry AS
    12 $$
    13 SELECT ST_Translate( ST_Rotate( ST_Translate( $1, -1*$2, -1*$3), $4), $2, $3)
    14 $$
    15    LANGUAGE 'sql';
    16 }}}
    175
    186== Construct Ellipse ==
     
    185173}}}
    186174
     175== Rotate Geometry around a Point ==
     176
     177Superseded by [https://postgis.net/docs/manual-3.0/ST_Rotate.html ST_Rotate].
     178
     179{{{
     180#!sql
     181CREATE OR REPLACE FUNCTION RotateAtPoint(
     182  geom geometry, pt_x double precision, pt_y double precision, angle double precision)
     183 RETURNS geometry AS
     184$$
     185SELECT ST_Translate( ST_Rotate( ST_Translate( $1, -1*$2, -1*$3), $4), $2, $3)
     186$$
     187   LANGUAGE 'sql';
     188}}}
    187189
    188190== Construct a multilinestring consisting of the interior and exterior rings of a polygon/multipolygon ==