<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hello Nicolas,</span></div><div><span>thank you for the reply. I don't have enough experience with postgis to understand how your suggestion helps.</span></div><div>Do you suggest to loop over all linestrings (which is really slow!) after st_dumppoints, or is there a single command that does the snapping at once?</div><div>What is the advantage of the intermediate points table? st_snap works with a given tolerance, or st_distance can help to select close-by lines... where do the points come in?</div><div><br></div><div>Thanks</div><div>Greg<br></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span
 style="font-weight:bold;">From:</span></b> Nicolas Ribot <nicolas.ribot@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Greg Polanski <polanski.greg@yahoo.com>; PostGIS Users Discussion <postgis-users@postgis.refractions.net> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, June 18, 2012 1:33 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] snapping all close-by lines in a set of 500,000<br> </font> </div> <br>
Hello,<br><br>I would create a table containing linestrings points (st_dumppoints)<br>then search for all lines whose points are within 50 meters from<br>another line, then either snap these points or remove the whole line.<br>Based on your dataset, you may have to union linestrings based on<br>attributes, to recreate continuous lines.<br><br>Nicolas<br><br>On 18 June 2012 10:01, Greg Polanski <<a ymailto="mailto:polanski.greg@yahoo.com" href="mailto:polanski.greg@yahoo.com">polanski.greg@yahoo.com</a>> wrote:<br>> Hello,<br>> I have a question about snapping a huge number of linestrings such that all<br>> lines that are almost parallel and within 50m collapse into one.<br>><br>> I have some 500,000 streets from Openstreetmap (classified as secondary or<br>> larger roads). Most of them are made of two or more lanes. For a more<br>> compact storage and faster rendering I need only a visual representation of<br>> each road.
 How can I collapse for example the 6 lanes of a motorway into one<br>> linestring?<br>><br>> Do I have to run a loop over all roads, snapping each of them to all others<br>> within the given tolerance? This seems extremely slow. Or can it be done<br>> once for all geometries?<br>> Do you have some SQL examples for a similar processing step?<br>><br>> Thanks<br>> Greg<br>><br>> _______________________________________________<br>> postgis-users mailing list<br>> <a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>> http://postgis.refractions.net/mailman/listinfo/postgis-users<br>><br><br><br> </div> </div>  </div></body></html>