[postgis-users] Proposed new functions

Bruce Rindahl rindahl at lrcwe.com
Tue Mar 13 11:31:25 PDT 2007


I already found a bug in the ellipse functions I proposed.  The ellipse came
out twice as big as it should be.  The correct functions are:

-- Function: Ellipse(double precision, double precision, double precision,
double precision, double precision, integer)

-- DROP FUNCTION Ellipse(double precision, double precision, double
precision, double precision, double precision, integer);

CREATE OR REPLACE FUNCTION Ellipse(double precision, double precision,
double precision, double precision, double precision, integer)
  RETURNS geometry AS
'SELECT translate( rotate( scale( buffer(makepoint(0,0), 0.5, $6), $3, $4),
$5), $1, $2)'
  LANGUAGE 'sql' IMMUTABLE STRICT;
ALTER FUNCTION Ellipse(double precision, double precision, double precision,
double precision, double precision, integer) OWNER TO postgres;


-- Function: Ellipse(double precision, double precision, double precision,
double precision, double precision)

-- DROP FUNCTION Ellipse(double precision, double precision, double
precision, double precision, double precision);

CREATE OR REPLACE FUNCTION Ellipse(double precision, double precision,
double precision, double precision, double precision)
  RETURNS geometry AS
'SELECT translate( rotate( scale( buffer(makepoint(0,0), 0.5), $3, $4), $5),
$1, $2)'
  LANGUAGE 'sql' IMMUTABLE STRICT;
ALTER FUNCTION Ellipse(double precision, double precision, double precision,
double precision, double precision) OWNER TO postgres;

The buffer radius was changed from 1 to 0.5

Thanks
Bruce Rindahl





More information about the postgis-users mailing list