<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2800.1528" name=GENERATOR>
<META content="Microsoft Word 10" name=Originator><LINK
href="cid:filelist.xml@01C63D17.1FFDB2A0" rel=File-List><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose; mso-style-noshow: yes; mso-ansi-font-size: 10.0pt; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=EN-US style="tab-interval: .5in" vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>Hi Fay,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>I think that this is the case for the demo_routing data:
the towns (town table) geometry are independant from the roads
(roads_europe table) ones.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial><FONT
color=#0000ff size=2>On my side, I tried to replay the procedure given in the
manual, section 1.2.4.2. </FONT></FONT></SPAN><SPAN
class=048273716-01032006><FONT face=Arial color=#0000ff size=2>Some steps
are not detailled and I had to search the nearest road start geometry
for each town in order to create the txt field of the roads_europe_vertices
table. To get most of the town listed, I had to go up to 2000m, and then get the
lowest distance for a given town.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>To make it short, the SQL script looks like
:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>CREATE TABLE roads_source_town AS<BR> select distinct
t.txt, source_id, distance(PointN(r.the_geom,1) , t.the_geom) as d from
roads_europe r, town t, roads_europe_vertices <BR> where t.txt
!= 'UNK' AND distance(PointN(r.the_geom,1) , t.the_geom) < 2000 AND geom_id =
source_id ORDER BY t.txt , d ; <BR>CREATE TABLE roads_source_town_uniq
AS<BR> select * from roads_source_town a where a.txt IN (select b.txt from
roads_source_town b where a.txt = b.txt limit 1) AND a.d IN (select b.d
from roads_source_town b where a.txt = b.txt limit
1);<BR>UPDATE roads_europe_vertices set txt = (select distinct txt
from roads_source_town_uniq where roads_europe_vertices.geom_id =
roads_source_town_uniq.source_id);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=048273716-01032006><FONT
face=Arial color=#0000ff size=2> </DIV></FONT></SPAN>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>I am not sure this is the solution done to build the <SPAN
class=emphasis>demo_routing.sql</SPAN> database, and it is not
optimized, but it works. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>Also it should be interesting to take in account the
whole line geometry of the roads instead of just the initial point
(PointN(r.the_geom,1))... but this may imply to cut some roads in several
source_id/target_id...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2>Franck</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=048273716-01032006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><BR> </DIV>
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>De :</B>
cartoweb-users-bounces@lists.maptools.org
[mailto:cartoweb-users-bounces@lists.maptools.org] <B>De la part de</B> Fay
Du<BR><B>Envoyé :</B> mercredi 1 mars 2006 16:02<BR><B>À :</B>
cartoweb-users@lists.maptools.org<BR><B>Objet :</B> [Cartoweb-users] A
question related with using pgdijkstra module<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi all:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><SPAN
style="mso-spacerun: yes"> </SPAN>I have a question
related with using pgdijkstra module. The module calculates optimized path node
by node. My network is a transportation network, if I have a point somewhere in
the area, for example, it can be a car’s location from GPS, and the point is not
on any edges of the network. What is the quick method to match the point to a
node in the network?<SPAN style="mso-spacerun: yes"> </SPAN>Are there any
examples somewhere? How does Cartoweb demo match city to a node in its
transportation network? I can search the nodes and find the closest one by
specifying a searching distance (for example, starting with 100 meters, then
increasing by 10 meters if no node find, and giving up is the searching distance
reaches 1000). Thanks in advance.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Fay<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P></DIV></BODY></HTML>