<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Will this function work?<br>
<br>
Does this look right<br>
<br>
--<br>
-- Name: polygon_radiant_to_latLong(geometry); Type: FUNCTION; Schema: public; Owner: -<br>
--<br>
<br>
CREATE OR REPLACE FUNCTION polygon_radian_to_latLong(geom geometry)<br>
returns geometry[] as<br>
$$<br>
select array_agg(latlong) from (<br>
select path,st_astext(geom) as "radians",st_setsrid(st_scale(st_astext(geom)::geometry,180.0/pi(),180.0/pi()),4326) as "latlong"<br>
  from ST_DumpPoints($1::geometry) as p) as foo;<br>
$$ LANGUAGE 'sql';<br>
<br>
ownsdb=# select * from (<br>
ownsdb(# select path,st_astext(geom) as "radians",st_astext(st_setsrid(st_scale(st_astext(geom)::geometry,180.0/pi(),180.0/pi()),4326)) as "latlong"<br>
ownsdb(#   from ST_DumpPoints('POLYGON((326454.7 5455793.7,326621.3 5455813.7,326455.4 5455796.6,326454.7 5455793.7))'::geometry) as p) as foo;<br>
 path  |          radians          |                 latlong                 <br>
-------+---------------------------+------------------------------------------<br>
 {1,1} | POINT(326454.7 5455793.7) | POINT(18704476.5122094 312593952.904064)<br>
 {1,2} | POINT(326621.3 5455813.7) | POINT(18714021.9890763 312595098.819654)<br>
 {1,3} | POINT(326455.4 5455796.6) | POINT(18704516.6192551 312594119.061824)<br>
 {1,4} | POINT(326454.7 5455793.7) | POINT(18704476.5122094 312593952.904064)<br>
(4 rows)<br>
<br>
<br>
select st_astext(unnest(polygon_radiant_to_latLong('POLYGON((326454.7 5455793.7,326621.3 5455813.7,326455.4 5455796.6,326454.7 5455793.7))'::geometry)));<br>
<br>
thanks<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF747828"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Burgess, Freddie<br>
<b>Sent:</b> Friday, December 05, 2014 5:40 PM<br>
<b>To:</b> PostGIS Users Discussion<br>
<b>Subject:</b> RE: [postgis-users] PostgreSQL 9.3.4/PostGIS 2.1.1 function<br>
</font><br>
</div>
<div></div>
<div>
<hr tabindex="-1">
<div id="divRplyFwdMsg"><font color="#000000" face="Tahoma" size="2"><b>From:</b> postgis-users-bounces@lists.osgeo.org [postgis-users-bounces@lists.osgeo.org] on behalf of Stephen Mather [stephen@smathermather.com]<br>
<b>Sent:</b> Friday, December 05, 2014 4:34 PM<br>
<b>To:</b> PostGIS Users Discussion<br>
<b>Subject:</b> Re: [postgis-users] PostgreSQL 9.3.4/PostGIS 2.1.1 function<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div><span style="font-size:12.7272720336914px">Sorry typos and such, try this again:</span></div>
<div><span style="font-size:12.7272720336914px"><br>
</span></div>
<font face="monospace">select st_astext(st_setsrid(st_scale(geom,180.0/pi(),180.0/pi()),4326)) FROM table_containing_polygons;</font><br>
<div><span style="font-size:12.7272720336914px"><br>
</span></div>
<div><span style="font-size:12.7272720336914px">Best,</span></div>
<div><span style="font-size:12.7272720336914px">Steve</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Dec 5, 2014 at 4:30 PM, Stephen Mather <span dir="ltr">
<<a href="mailto:stephen@smathermather.com" target="_blank">stephen@smathermather.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div><span style="font-size:12.7272720336914px">Hi Freddie,</span></div>
<div><span style="font-size:12.7272720336914px"><br>
</span></div>
<span style="font-size:12.7272720336914px">select st_astext(st_setsrid(st_scale(</span><span style="font-size:12.7272720336914px">'POINT(1</span><br style="font-size:12.7272720336914px">
<span style="font-size:12.7272720336914px">1)'::geometry,180.0/pi(),180.</span><span style="font-size:12.7272720336914px">0/pi()),4326)) FROM table_containing_polygon;</span><br>
<div><span style="font-size:12.7272720336914px"><br>
</span></div>
<div><span style="font-size:12.7272720336914px">Best,</span></div>
<div><span style="font-size:12.7272720336914px">Steve</span></div>
<div><span style="font-size:12.7272720336914px"><br>
</span></div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Dec 5, 2014 at 3:33 PM, Burgess, Freddie <span dir="ltr">
<<a href="mailto:FBurgess@radiantblue.com" target="_blank">FBurgess@radiantblue.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
How would I do this on a polygon?<br>
<br>
Thanks<br>
________________________________________<br>
From: <a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a> [<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] on behalf of Paul Ramsey
 [<a href="mailto:pramsey@cleverelephant.ca" target="_blank">pramsey@cleverelephant.ca</a>]<br>
Sent: Thursday, December 04, 2014 6:51 PM<br>
To: PostGIS Users Discussion<br>
Subject: Re: [postgis-users] PostgreSQL 9.3.4/PostGIS 2.1.1 function<br>
<div>
<div><br>
I would think that scaling by 180/pi should do the trick in general?<br>
<br>
select st_astext(st_setsrid(st_scale('POINT(1 1)'::geometry,180.0/pi(),180.0/pi()),4326));<br>
<br>
P<br>
<br>
On Thu, Dec 4, 2014 at 3:24 PM, Burgess, Freddie<br>
<<a href="mailto:FBurgess@radiantblue.com" target="_blank">FBurgess@radiantblue.com</a>> wrote:<br>
> Given a polygon geometry with no SRID, the vertices actually in radians, but<br>
> since the SRID is zero, it looks like Cartesian coordinates, I want the lat<br>
> long in degrees and not rads.<br>
><br>
> Does anyone provide of a function/custom that will return lat/long in<br>
> degrees given the conditions described?<br>
><br>
> thanks<br>
><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>