<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:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="phone"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
code
        {font-family:"Courier New";}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=ES link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I´ve
got a polylines layer (pipes) and a points layer (valves) and In Postgis 1.4 I
would like to obtain the closest points but exactly on the closest polyline. In
other words, i need to locate each valve over the closest point on a pipe but
taking into account that there is not only one polyline but many and that i am
using postgis 1.4 and St_ClosestPoint() that could help to solve this problem
doesn't still exist on my postgis version.<o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><img
width=590 height=520 id="_x0000_i1031" src="cid:image001.gif@01CE0094.321D64B0"
alt=ClosestPoint><o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>I
read that the following statement works if it is used for one polyline, but I need
to be processed for all the polylines on the table:<o:p></o:p></span></font></p>

<pre><code><font size=2 face="Courier New"><span lang=EN-GB style='font-size:
10.0pt'>SELECT </span></font></code><strong><b><font face="Courier New"><span
lang=EN-GB style='font-family:"Courier New"'>ST_Line_Interpolate_Point</span></font></b></strong><code><font
face="Courier New"><span lang=EN-GB>(<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>               line_to_project_onto.the_geom,<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>               </span></font></code><strong><b><font
face="Courier New"><span lang=EN-GB style='font-family:"Courier New"'>ST_Line_Locate_Point</span></font></b></strong><code><font
face="Courier New"><span lang=EN-GB>(<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>                       line_to_project_onto.the_geom,<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>                       points_to_project_onto_line.the_geom<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>               )<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>        )<o:p></o:p></span></font></code></pre><pre><code><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt'>FROM line_to_project_onto, points_to_project_onto_line;</span></font></code><font
face=Arial><span lang=EN-GB style='font-family:Arial'><o:p></o:p></span></font></pre>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>If
theres a way to add the St_ClosestPoint() function to my Postgis 1.4 could also
help but i think i need to create a new function for this. Thanks in advance. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Regards, <o:p></o:p></span></font></p>

<p class=MsoNormal><b><font size=1 color="#336699" face=Verdana><span
lang=EN-GB style='font-size:9.0pt;font-family:Verdana;color:#336699;font-weight:
bold'><o:p> </o:p></span></font></b></p>

<p class=MsoNormal><b><font size=1 color="#336699" face=Verdana><span
style='font-size:9.0pt;font-family:Verdana;color:#336699;font-weight:bold'>Aitor
Gil Martin<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=1 color="#336699" face=Verdana><span
style='font-size:9.0pt;font-family:Verdana;color:#336699;font-weight:bold'>Departamento
Informática</span></font></b><o:p></o:p></p>

<p class=MsoNormal><b><font size=1 color="#336699" face=Verdana><span
style='font-size:9.0pt;font-family:Verdana;color:#336699;font-weight:bold'>Getxoko
Udala / Ayto Getxo</span></font></b><o:p></o:p></p>

<p class=MsoNormal><font size=1 color="#336699" face=Verdana><span
style='font-size:8.0pt;font-family:Verdana;color:#336699'>Tel: <st1:phone
o:ls="trans" w:st="on">94 466 02 16</st1:phone> Ext.- 3457</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><a href="http://www.getxo.net/" title="http://www.getxo.net/"><font
size=1 face=Verdana><span style='font-size:8.0pt;font-family:Verdana'><span
title="http://www.getxo.net/">www.getxo.net</span></span></font></a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><a href="mailto:agmartin@getxo.net" title="mailto:agmartin@getxo.net"><font
size=1 face=Verdana><span lang=EN-GB style='font-size:8.0pt;font-family:Verdana'><span
title="mailto:agmartin@getxo.net">agmartin</span></span></font></a><a
href="mailto:agmartin@getxo.net" title="mailto:agmartin@getxo.net"><font
size=1 face=Verdana><span style='font-size:8.0pt;font-family:Verdana'><span
title="mailto:agmartin@getxo.net">@getxo.net</span></span></font></a></span><o:p></o:p></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

</body>

</html>