<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" 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"><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.6001.18349" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@page WordSection1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
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 vLink=purple link=blue>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=421291419-22062010>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></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=421291419-22062010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=421291419-22062010>-Eric </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>--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 </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>drop table<SPAN 
class=421291419-22062010> if exists</SPAN> hex1000;<BR>create table hex1000 
as<BR>select translate(<SPAN 
class=421291419-22062010>st_</SPAN>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;</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV>
<P><FONT size=2></FONT></P><FONT face=Tahoma size=2><FONT face=Arial 
color=#0000ff></FONT>-----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<BR><BR></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=WordSection1>
  <P class=MsoNormal>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><o:p> </o:p></P>
  <P class=MsoNormal>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><o:p> </o:p></P>
  <P class=MsoNormal>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><o:p> </o:p></P>
  <P class=MsoNormal>Does anybody have some advice for creating a POLYGON from 3 
  or more separate LINESTRINGs?<o:p></o:p></P></DIV></BLOCKQUOTE></BODY></HTML>