<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Thanks all for your help</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bob Pawley</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://www.automatingdesign.com">www.automatingdesign.com</A>
</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=robe.dnd@cityofboston.gov
href="mailto:robe.dnd@cityofboston.gov">Obe, Regina</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=postgis-users@postgis.refractions.net
href="mailto:postgis-users@postgis.refractions.net">PostGIS Users
Discussion</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, May 01, 2008 5:19
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [postgis-users] Line To
Path</DIV>
<DIV><BR></DIV>
<DIV dir=ltr align=left><SPAN class=411260712-01052008><FONT face=Arial
color=#0000ff size=2>I wouldn't quite call it runnning the function in that
table. Basically the SQL statement will create a temporary or in memory
table so to speak. So short answer - yes it is correct - no need to
create a new table or geometry column. Sometimes you may want to if you
use it often or you are grouping many geometries since the planner has to
recalculate each time if it is a dynamic query as below or view (a saved
dynamic query as Kevin pointed out in last post) .</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411260712-01052008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411260712-01052008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411260712-01052008><FONT face=Arial
color=#0000ff size=2>Well there should be an alias there otherwise it usually
will just alias it as something dumb like ST_Union - so let me correct my
mistake.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411260712-01052008>SELECT somefield,
ST_Union(the_geom) as newgeom<BR>FROM sometable<BR>GROUP BY
somefield;</SPAN></DIV>
<DIV><SPAN class=411260712-01052008></SPAN> </DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>If
you wanted to materialize it, I tend to do something like</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>SELECT somefield, <FONT face="Times New Roman" color=#000000
size=3>ST_Union(the_geom) as newgeom</FONT><BR>INTO
somenewtable</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>FROM
sometable</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>GROUP BY somefield;</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>A
lot of people do </FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>CREATE TABLE somenewtable As </FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>SELECT somefield, <FONT face="Times New Roman" color=#000000
size=3>ST_Union(the_geom) as newgeom</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>FROM
sometable</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>GROUP BY somefield;</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>But
I tend to avoid that second syntax since its not as portable as option 1 (from
DBMS to DBMS at least the DBMS I tend to deal with) and the speed is the
same. Granted</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>I
guess the second version is a bit clearer.</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff size=2>Hope
that helps,</FONT></SPAN></DIV>
<DIV><SPAN class=411260712-01052008><FONT face=Arial color=#0000ff
size=2>Regina</FONT></SPAN></DIV></SPAN><SPAN class=411260712-01052008></DIV>
<DIV dir=ltr align=left><BR></DIV></SPAN><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>George Silva<BR><B>Sent:</B> Wednesday, April 30, 2008 10:47
PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re:
[postgis-users] Line To Path<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>In the same trailing of that question and the answer, that select
statement would run the function st_union in that table, without the need to
create a new table or geometry column?</DIV>
<DIV> </DIV>
<DIV>Sorry to use this post for this, just tought its a quite novice question,
so more people could use the answer.</DIV>
<DIV> </DIV>
<DIV>Thx</DIV>
<DIV> </DIV>
<DIV>Att.</DIV>
<DIV> </DIV>
<DIV>George<BR><BR></DIV>
<DIV class=gmail_quote>On Wed, Apr 30, 2008 at 7:20 PM, Paragon Corporation
<<A href="mailto:lr@pcorp.us">lr@pcorp.us</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Bob,<BR><BR>If
I understand you correctly, I think you want to use one of the
following<BR><BR>SELECT somefield, ST_Union(the_geom)<BR>FROM
sometable<BR>GROUP BY somefield<BR><BR>So lets say you want to collapse 3
rows into 1 then you just need to group<BR>by some common field.<BR><BR>E.g.
if somefield = 1 for your 3 records, then those would get rolled into<BR>the
same record.<BR><BR>The above will give you a LINESTRING or MULTILINESTRING.
If you have all<BR>LINESTRINGS, then may be more efficient to do this.
The below will first<BR>collapse all with common somefield into a
MULTILINESTRING and then the<BR>LineMerge will do the best it can to stitch
back into a single line string.<BR>This is not possible with completely
disjoint linestrings.<BR><BR>SELECT somefield,
ST_LineMerge(ST_Collect(the_geom))<BR>FROM sometable<BR>GROUP BY
somefield<BR><BR><BR>If you are using the older version of Postgis, you can
just take out the ST_<BR>in the examples I have above.<BR><BR>Hope that
helps,<BR>Regina<BR>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c><BR>-----Original Message-----<BR>From: <A
href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</A><BR>[mailto:<A
href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</A>]
On Behalf Of Bob<BR>Pawley<BR>Sent: Wednesday, April 30, 2008 12:40
PM<BR>To: PostGIS Users Discussion<BR>Subject: [postgis-users] Line To
Path<BR><BR>Is there a method of converting three lines that require three
rows into a<BR>path that occupies a single row??<BR><BR>Bob
Pawley<BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR><BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR>
<P>
<HR SIZE=1>
<P></P>
<P><STRONG>The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure pursuant to
Massachusetts law. It is intended solely for the addressee. If you received
this in error, please contact the sender and delete the material from any
computer. </STRONG></P>
<P>
<HR SIZE=1>
<P></P>
<P><STRONG><FONT color=#339900 size=2>Help make the earth a greener place. If
at all possible resist printing this email and join us in saving paper. </P>
<P></FONT></STRONG></P>
<P>
<HR>
<P></P>_______________________________________________<BR>postgis-users
mailing
list<BR>postgis-users@postgis.refractions.net<BR>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></BLOCKQUOTE></BODY></HTML>