[postgis-users] Ellipse Function Issue.

Echelon cparvis at gmail.com
Wed Nov 16 10:47:56 PST 2016


I am trying to create ellipses from fields in my posgres table. I found this
custom Ellipse function and have been trying to tweak it to meet my needs. 

CREATE OR REPLACE FUNCTION Ellipse(double precision, double precision,
double precision, double precision, double precision, integer)
 RETURNS geometry AS
 $$
   SELECT ST_Translate( ST_Rotate( ST_Scale( ST_Buffer(ST_Point(0,0), 0.5,
$6), $3, $4), $5), $1, $2)
$$
 LANGUAGE 'sql';

My inputs into this are a lat and lon, the a Smajor/Sminor in meters. I
receive my rotation in degrees but have a written a function that has
converted them to radians per the requirements as stated in some of the
other forums I've seen with this similar problem. I have tweaked the above
method to this:

CREATE OR REPLACE FUNCTION Ellipse2(double precision, double precision,
double precision, double precision, double precision, integer)
 RETURNS geometry AS
 $$
   SELECT ST_Translate( ST_SetSRID( ST_Rotate( ST_Scale( ST_Buffer(
ST_SetSRID( ST_Point(0,0), 3395), 0.5, $6), $3, $4), $5), 4326), $1, $2)
$$
 LANGUAGE 'sql';

I create the point (0,0) and then set it's SRID to 3395 since that's a
meters based system in hopes that would then make scale use meters when it
extrapolates the smajor/sminor sides. I'm getting ellipses that are massive
though (i.e. continent size not 600 meter size) I'm pretty sure my issue is
with projection based units. Can someone point out to me what I am doing
wrong? 

Thanks
Echelon





--
View this message in context: http://postgis.17.x6.nabble.com/Ellipse-Function-Issue-tp5010624.html
Sent from the PostGIS - User mailing list archive at Nabble.com.


More information about the postgis-users mailing list