<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal><span style='color:#1F497D'>I believe I have figured out
what the problem was. It seems that through the process of creating the
CIRCULARSTRING and then converting it to a LINESTRING using st_curvetoline the
value of the endpoints of the curve are not quite the same as endpoints of the
chords upon which it is based. <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Whether this is due to a precision
loss when getting the the x/y coordinate values as input for the
CIRCULARSTRING, or whether it is a floating point precision problem when comparing
the points I don’t know, but I do have a solution for anyone who is
interested: Simply replace the end points of the CIRCULARSTRING after
converting it to a LINESTRING with the known ‘good’ endpoints from
the chords. The updated function below should reflect the changes. <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Thanks for the help Eric, it gave
me part of the solution and got me thinking in the right direction to get the
rest of it.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>CREATE OR REPLACE FUNCTION
wedgefunc(outerradius float, startangle float, openingangle float)<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> RETURNS text AS<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>$BODY$<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> DECLARE<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> startchord
geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> midchord
geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> endchord geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> revstartchord
geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarc
text;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarcline
geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> poly
geometry;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> BEGIN<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> -- Rotate a horizontal
line to form chords - the 'mid' chord is to help form the CIRCULARLINESTRING<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> startchord
:= st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle);<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> midchord
:= st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle +
(.5 * openingangle));<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> endchord
:= st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle
+ openingangle);<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> --Make a reversal of the
start chord - not sure if this is needed, just incase the points need to be in
order when putting together the poly<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> revstartchord
:= st_reverse(startchord); <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> --Create an arc line by
passing the endpoints of the endchord, midchord, and startchord<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarc
:= 'CIRCULARSTRING('||st_x(st_endpoint(endchord))||'
'||st_y(st_endpoint(endchord))||','||st_x(st_endpoint(midchord))||'
'||st_y(st_endpoint(midchord))||','||st_x(st_endpoint(startchord))||'
'||st_y(st_endpoint(startchord))||')';<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarcline
:= st_curvetoline(outerarc);<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> --Replace the start/end
points in the arc LINESTRING with points from the chords to ensure the ring is
closed<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarcline
:= st_setpoint(outerarcline,0,st_endpoint(endchord));<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> outerarcline
:=
st_setpoint(outerarcline,st_numpoints(outerarcline)-1,st_startpoint(revstartchord));<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> --Create the polygon by
combining the individual LINESTRINGS<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> poly
:= st_buildarea(st_collect(geom))<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> FROM
(select revstartchord as geom<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> union
select endchord as geom<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> union
select outerarcline as geom<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> )
as u;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> return
st_astext(poly);<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> END;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> $BODY$<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'> LANGUAGE 'plpgsql'
IMMUTABLE;<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <b>On Behalf Of </b>Avery
Penniston<br>
<b>Sent:</b> Tuesday, June 22, 2010 3:00 PM<br>
<b>To:</b> PostGIS Users Discussion<br>
<b>Subject:</b> Re: [postgis-users] Create POLYGON from Several LINESTRINGs<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>Thanks
for the reply.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>I tried
to use the st_buildarea with st_collect as you suggested by modifying my
wedgefunc function that I posted earlier. However, now I don’t get
anything out of the function. I believe the collect is returning a
MULTILINESTRING with the three elements to my wedge in it, but for some reason
the st_buildarea function is returning nothing. Any ideas?<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>Here is
my modified wedgefunc function:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>CREATE
OR REPLACE FUNCTION wedgefunc(outerradius float, startangle float, openingangle
float)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
RETURNS text AS<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>$BODY$<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
DECLARE<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
startchord geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
midchord geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
endchord geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
revstartchord geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
outerarc text;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
outerarcline geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
polyborder geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
poly geometry;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
BEGIN<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
-- Rotate a horizontal line to form chords - the 'mid' chord is to help form
the CIRCULARLINESTRING<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
startchord :=
st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
midchord := st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle
+ (.5 * openingangle));<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
endchord :=
st_rotate(st_makeline(st_point(0,0),st_point(outerradius,0)),startangle +
openingangle);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
--Make a reversal of the start chord - not sure if this is needed, just incase
the points need to be in order when putting together the poly<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
revstartchord := st_reverse(startchord); <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
--Create an arc line by passing the endpoints of the endchord, midchord, and
startchord<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
outerarc := 'CIRCULARSTRING('||st_x(st_endpoint(endchord))||'
'||st_y(st_endpoint(endchord))||','||st_x(st_endpoint(midchord))||'
'||st_y(st_endpoint(midchord))||','||st_x(st_endpoint(startchord))||'
'||st_y(st_endpoint(startchord))||')';<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
outerarcline := st_curvetoline(outerarc);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
--TRYING ST_BUILDAREA WITH ST_COLLECT AFTER UNIONING THE 3 LINESTRINGS<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
poly := st_buildarea(st_collect(geom))<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
FROM (select revstartchord as geom<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
union select endchord as geom<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
union select outerarcline as geom<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
) as u;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
return st_astext(poly);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
END;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
$BODY$<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'>
LANGUAGE 'plpgsql' IMMUTABLE;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal style='margin-left:1.0in'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>
postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net]
<b>On Behalf Of </b>Randall, Eric<br>
<b>Sent:</b> Tuesday, June 22, 2010 2:26 PM<br>
<b>To:</b> PostGIS Users Discussion<br>
<b>Subject:</b> Re: [postgis-users] Create POLYGON from Several LINESTRINGs<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal style='margin-left:1.0in'><o:p> </o:p></p>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:blue'>I think perhaps st_buildarea and
st_collect might be what you want. Below is what I used to create a
hexagon out of points->lines which was then translated (using
generate_series) across X and Y to create a hexagonal grid for the
County. There's probably a simpler way to make a hexagon but it
illustrates the st_buildarea. Maybe that helps.</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:blue'>-Eric </span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:blue'>--let's make a hexagon with 1000
foot sides and position it with it's <br>
--center at 1210000, 610000 (the lower left of the pamap tile extent for Erie
County)<br>
--and create a table </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:blue'>drop table if exists hex1000;<br>
create table hex1000 as<br>
select translate(st_buildarea(st_collect(geom)),1210000, 610000) as geom
from <br>
(select makeline(st_endpoint(makeline(makepoint(0, 0),makepoint(0, -
1000))),st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0, -1000)),
radians(300)))) as geom <br>
union select makeline(st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(300))),st_endpoint(rotate(makeline(makepoint(0,
0),makepoint(0, -1000)), radians(240)))) as geom <br>
union select makeline(st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(240))),st_endpoint(rotate(makeline(makepoint(0,
0),makepoint(0, -1000)), radians(180)))) as geom <br>
union select makeline(st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(180))),st_endpoint(rotate(makeline(makepoint(0,
0),makepoint(0, -1000)), radians(120)))) as geom <br>
union select makeline(st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(120))),st_endpoint(rotate(makeline(makepoint(0,
0),makepoint(0, -1000)), radians(60)))) as geom <br>
union select makeline(st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(60))),st_endpoint(rotate(makeline(makepoint(0, 0),makepoint(0,
-1000)), radians(0)))) as geom <br>
) as t1;</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='margin-left:1.0in'><span style='font-size:12.0pt;
font-family:"Times New Roman","serif"'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:
12.0pt;margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>-----Original
Message-----<br>
<b>From:</b> postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net]<b>On Behalf Of </b>Avery
Penniston<br>
<b>Sent:</b> Tuesday, June 22, 2010 2:38 PM<br>
<b>To:</b> postgis-users@postgis.refractions.net<br>
<b>Subject:</b> Re: [postgis-users] Create POLYGON from Several LINESTRINGs</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<blockquote style='margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>
<p class=MsoNormal style='margin-left:1.0in'>I’m trying to create
‘pie wedge’ shaped polygons by building them in a Postgres
function. I am able to create the 2 straight chords and the arc as
separate LINESTRINGs, and I have verified that each LINESTRING shares its
endpoints with the other two LINESTRINGs. However, I am having trouble
putting the individual parts together to form a POLYGON.<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:1.0in'>I tried to ST_UNION the 3
LINESTRINGs together, and the result is a MULTILINESTRING. I then call
ST_LINEMERGE to convert the MULTILINESTRING to a single LINESTRING so I can
pass it to the ST_POLYGON function, but the result of the ST_LINEMERGE is a
MULTILINESTRING. <o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:1.0in'>I tried using ST_COLLECT instead
of ST_UNION, but then I got a GEOMETRYCOLLECTION containing a MULTILINESTRING
and a LINESTRING.<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:1.0in'>Does anybody have some advice for
creating a POLYGON from 3 or more separate LINESTRINGs?<o:p></o:p></p>
</blockquote>
</div>
</body>
</html>