<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<STYLE>.hmmessage P {
        PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-FAMILY: Verdana; FONT-SIZE: 10pt
}
</STYLE>

<META name=GENERATOR content="MSHTML 8.00.6001.18783"></HEAD>
<BODY class=hmmessage>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>Nelson,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>I wonder if it would help to calculate the centroid of the 
multilinestring and then project that centroid unto the multiline where the 
distance between the centroid and the line is the shortest (using combination of 
ST_Dump, st_line_locate_point and st_line_interpolate_point)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>Haven't really thought much what the query would look like, but just 
a thought.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>So basically</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>1) For the line mergeable ones do what you are 
doing</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>2) For the non-mergeable ones do a </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>   a) Take centroid</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>b) ST_Dump MULTILINESTRING</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>c) Choose the linestring with the min(ST_Distance(centroid,line)) for 
that MULTILINESTRING</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>  d) ST_Line_Interpolate_Point(line, ST_Line_Locate_Point(line, 
centroid))</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671492019-19072009><FONT color=#0000ff 
face=Arial>Leo</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT face=Tahoma><B>From:</B> postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>Nelson Correia<BR><B>Sent:</B> Sunday, July 19, 2009 1:41 PM<BR><B>To:</B> 
postgis-users@postgis.refractions.net<BR><B>Subject:</B> Re: [postgis-users] 
Finding the center of a street<BR></FONT><BR></DIV>
<DIV></DIV> <BR>Hi Luigi,<BR> <BR>The problem is that when I have T 
junctions, I have more than one segment (i.e. linestring) and even if 
I use ST_LineMerge, I get a set of linestrings (instead of only one), 
which I can't pass to <SPAN class=term>ST_line_interpolate_point (the function 
I'm using to calculate the middle point).</SPAN><BR><SPAN 
class=term></SPAN> <BR><SPAN class=term>For the use case I have, the 
calculated middle point must be part of the street (i.e. part of the 
multilinestring that I have initially).</SPAN><BR><SPAN 
class=term></SPAN> <BR><SPAN class=term>Thanks,</SPAN><BR><SPAN 
class=term></SPAN> <BR><SPAN class=term>Nelson</SPAN><BR><BR> <BR>
<HR id=stopSpelling>
From: luigi.cardeles@gmail.com<BR>Date: Sat, 18 Jul 2009 01:51:58 -0300<BR>To: 
postgis-users@postgis.refractions.net<BR>Subject: Re: [postgis-users] Finding 
the center of a street<BR><BR>Hi Nelson,<BR><BR>i don't understand the problem 
with the T junctions but with the non-contiguous sections you could create a 
contiguous linestring and use that to find the middle point but you may get 
middle points that don't intersects with then. Is this a problem?<BR><BR>[]'s<BR 
clear=all>Luigi Castro Cardeles<BR><BR><BR>
<DIV class=EC_gmail_quote>2009/7/16 Nelson Correia <SPAN dir=ltr><<A 
href="mailto:nelsonwc7@hotmail.com">nelsonwc7@hotmail.com</A>></SPAN><BR>
<BLOCKQUOTE style="PADDING-LEFT: 1ex" class=EC_gmail_quote>
  <DIV>Hi all,<BR> <BR>I have a database of streets, wich is composed by 
  multilinestring segments. I want to find the centre of the street (i.e. the 
  point that is in the middle and contained in the street geometry) and not the 
  centroid (which may not be in the street).<BR> <BR>I can do this with 
  linemerge (to obtain a linestring instead of a multilinestring) and then use 
  the st_line_interpolate_point to calculate the middle point.<BR> <BR>The 
  problem is with streets that have T junctions in the middle or that are 
  composed by non-contiguous sections, for what I can't find a way to obtain a 
  linestring to calculate the middle point.<BR> <BR>Anyone had a similar 
  problem or know a solution to this problem?<BR> <BR>Thanks in 
  advance!<BR> <BR>Nelson<BR><BR><BR>
  <HR>
  check out the rest of the Windows Live™. More than mail–Windows Live™ goes way 
  beyond your inbox. <A 
  href="http://www.microsoft.com/windows/windowslive/">More than 
  messages</A></DIV><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">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR></BLOCKQUOTE></DIV><BR><BR>
<HR>
check out the rest of the Windows Live™. More than mail–Windows Live™ goes way 
beyond your inbox. <A href="http://www.microsoft.com/windows/windowslive/" 
target=_new>More than messages</A> </BODY></HTML>