Hi Roger,<div><br></div><div>You could also try to use PostGIS to calculate concave hull function:</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://postgis.org/documentation/manual-svn/ST_ConcaveHull.html">http://postgis.org/documentation/manual-svn/ST_ConcaveHull.html</a></div>
<div><br></div><div>When driving_distance function was written some time ago this function wasn't written yet in PostGIS (or wasn't very fast, I don't rmember exactly the reason, why CGAL was chosen). Nevertheless it would be nice to get rid of CGAL dependency and use the PostGIS function instead. Just nobody has done this yet ;-)</div>
<div><br></div><div>So you could take the query as in your first email and take the geometry of the list of vertices as input for the concave hull function.</div><div><br></div><div>Daniel</div><div><br></div><div><a href="http://postgis.org/documentation/manual-svn/ST_ConcaveHull.html"></a><br>
<br><div class="gmail_quote">2010/12/22 Daniel Kastl <span dir="ltr"><<a href="mailto:daniel@georepublic.de">daniel@georepublic.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Roger,<div><br></div><div>What OS do you use?</div><div>I haven't run Driving Distance function for a while and recently upgraded to a newer version of Ubuntu.</div><div>In my case it says: ERROR: function alphashape(unknown) does not exist</div>
<div><br></div><div>Might be that something has changed there with the dependent library (CGAL), which is used to calculate the polygon.</div><div>I can't remember there was a problem in the past. </div><div><div></div>
<div class="h5"><div><br></div>
<div>Daniel</div><div><br></div><div><br><br><div class="gmail_quote">2010/12/22 Roger André <span dir="ltr"><<a href="mailto:randre@gmail.com" target="_blank">randre@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ok, so using what I think is the correct SQL syntax, I get a different sort of error:<div><br></div><div><div><font face="'courier new', monospace">eligibility=# SELECT the_geom FROM driving_distance('edges', 2512140, 7040129, 2000, 'length', 'length', false, false);</font></div>
<div><font face="'courier new', monospace">NOTICE: SRID: 2276</font></div><div><font face="'courier new', monospace">NOTICE: Query: SELECT gid, the_geom FROM points_as_polygon('SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance(''''SELECT gid AS id,source::integer,target::integer, length::double precision AS cost, length::double precision as reverse_cost FROM edges WHERE setsrid(''''''''BOX3D(2510140 7038129, 2514140 7042129)''''''''::BOX3D, 2276) && the_geom '''', (SELECT id FROM find_node_by_nearest_link_within_distance(''''POINT(2512140 7040129)'''',200,''''edges'''')),2000,true,true) a, (SELECT * FROM edges WHERE setsrid(''''BOX3D(2510140 7038129, 2514140 7042129)''''::BOX3D, 2276)&&the_geom) b WHERE a.vertex_id = b.source')</font></div>
<div><font face="'courier new', monospace">ERROR: function find_node_by_nearest_link_within_distance(unknown, integer, unknown) does not exist</font></div><div><font face="'courier new', monospace">LINE 1: ...)''::BOX3D, 2276) && the_geom ', (SELECT id FROM find_node_...</font></div>
<div><font face="'courier new', monospace"> ^</font></div><div><font face="'courier new', monospace">HINT: No function matches the given name and argument types. You might need to add explicit type casts.</font></div>
<div><font face="'courier new', monospace">QUERY: SELECT a.vertex_id::integer AS id, b.x1::double precision AS x, b.y1::double precision AS y FROM driving_distance('SELECT gid AS id,source::integer,target::integer, length::double precision AS cost, length::double precision as reverse_cost FROM edges WHERE setsrid(''BOX3D(2510140 7038129, 2514140 7042129)''::BOX3D, 2276) && the_geom ', (SELECT id FROM find_node_by_nearest_link_within_distance('POINT(2512140 7040129)',200,'edges')),2000,true,true) a, (SELECT * FROM edges WHERE setsrid('BOX3D(2510140 7038129, 2514140 7042129)'::BOX3D, 2276)&&the_geom) b WHERE a.vertex_id = b.source</font></div>
<div><font face="'courier new', monospace">CONTEXT: PL/pgSQL function "points_as_polygon" line 17 at FOR over EXECUTE statement</font></div><div><font face="'courier new', monospace">PL/pgSQL function "driving_distance" line 25 at FOR over EXECUTE statement</font></div>
<div><br></div>Still puzzling this one out.</div><div>--</div><div><div></div><div><div><br></div><div><br><div class="gmail_quote">On Tue, Dec 21, 2010 at 7:55 PM, Roger André <span dir="ltr"><<a href="mailto:randre@gmail.com" target="_blank">randre@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel,<div><br></div><div>Thanks for your reply. I checked, and it appears that I have that wrapper function installed. Here is what my pgrouting install dir looks like:</div>
<div><br></div><div><div><font face="'courier new', monospace">$ pwd</font></div>
<div><font face="'courier new', monospace">/usr/local/pgrouting-1.05/extra/driving_distance/sql</font></div><div><br></div><div><div><font face="'courier new', monospace">$ ll</font></div>
<div><font face="'courier new', monospace">total 36</font></div><div><font face="'courier new', monospace">drwxr-xr-x 3 15036 users 4096 2010-12-21 15:58 ./</font></div>
<div><font face="'courier new', monospace">drwxr-xr-x 5 15036 users 4096 2010-12-21 15:58 ../</font></div><div><font face="'courier new', monospace">drwxr-xr-x 2 root root 4096 2010-12-21 15:58 CMakeFiles/</font></div>
<div><font face="'courier new', monospace">-rw-r--r-- 1 root root 1811 2010-12-21 15:58 cmake_install.cmake</font></div><div><font face="'courier new', monospace">-rw-r--r-- 1 15036 users 134 2010-11-16 18:42 CMakeLists.txt</font></div>
<div><font face="'courier new', monospace">-rw-r--r-- 1 root root 5540 2010-12-21 15:58 Makefile</font></div><div><font face="'courier new', monospace">-rw-r--r-- 1 15036 users 1757 2010-11-16 18:42 routing_dd.sql</font></div>
<div><font face="'courier new', monospace">-rw-r--r-- 1 15036 users 3790 2010-11-16 18:42 routing_dd_wrappers.sql</font></div></div><div><br></div><div>And I did make sure to run both SQL files against the database my roads are stored in.</div>
<div><br></div><div><div><font face="'courier new', monospace"> 482 psql -d eligibility -f routing_dd.sql</font></div><div><font face="'courier new', monospace"> 483 psql -d eligibility -f routing_dd_wrappers.sql </font></div>
<div><font face="'courier new', monospace"> 490 psql -d eligibility -f routing_tsp.sql </font></div><div><font face="'courier new', monospace"> 491 psql -d eligibility -f routing_tsp_wrappers.sql </font></div>
</div><div><br></div><div>I will review your usage instructions and see if I'm missing anything.</div><div><br></div><div>Roger</div><div>--</div><div><div></div><div><br><div class="gmail_quote">On Tue, Dec 21, 2010 at 5:51 PM, Daniel Kastl <span dir="ltr"><<a href="mailto:daniel@georepublic.de" target="_blank">daniel@georepublic.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Roger,<div><br></div><div>You're using the "core" function, I think.</div><div>You could use the driving_distance wrapper function, which will return you a polyogon.</div>
<div>For that you need to load this SQL: <a href="https://github.com/pgRouting/pgrouting/blob/master/extra/driving_distance/sql/routing_dd_wrappers.sql" target="_blank">https://github.com/pgRouting/pgrouting/blob/master/extra/driving_distance/sql/routing_dd_wrappers.sql</a></div>
<div>You can also find it in the directory where the other pgRouting SQL files are.</div><div><br></div><div>The function will take these parameters then:</div><div><br></div><div><div>driving_distance(table_name varchar, x double precision, y double precision,</div>
<div> distance double precision, cost varchar, reverse_cost varchar, directed boolean, has_reverse_cost boolean)</div></div><div><br></div><div>X,Y are the coordinates you take as a center point.</div><div>You can take the returned polygon then and do other spatial queries.</div>
<div><br></div><div>Best regards,</div><div>Daniel</div><div><br></div><div><br><br><div class="gmail_quote">2010/12/22 Roger André <span dir="ltr"><<a href="mailto:randre@gmail.com" target="_blank">randre@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>Hi All,<br><br>I need to generate some maps that show all of the road segments that are within a certain distance of specific points. I have been able to generate some answers using the driving_distance function, but am not sure what to do with them. Here's what I get:<br>
<br><span style="font-family:courier new,monospace"># SELECT * FROM driving_distance('SELECT gid AS id, source, target, length::double precision AS cost FROM edges',49,2000,false,false);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> vertex_id | edge_id | cost </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">-----------+---------+------------------</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 15 | 9 | 1854.34547361565</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> 20 | 104 | 1549.85630678904</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 22 | 68 | 858.367668935802</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> 23 | 125 | 1466.02479201359</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 24 | 75 | 801.137871846872</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> 25 | 125 | 1169.02817170106</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 26 | 106 | 1296.98197602289</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> 48 | 71 | 902.595810873304</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 49 | 106 | 0</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> 51 | 74 | 1948.07551810288</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> 52 | 75 | 1620.93404864578</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">(11 rows)</span><br><br>These answers seem legit, but I'm not sure what to do with them. Ultimately, I need to show both the minimum enclosing polygon that "surrounds" all of the road segments, as well as the road segments themselves. Can someone please give me some pointers as to what I can do to accomplish this?<br>
<br>Thanks,<br><br>Roger<br><font color="#888888">--<br>
</font><br></div></div>_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66, 99, 171)" target="_blank">daniel.kastl@georepublic.de</a><br>
Web: <a href="http://georepublic.de/" style="color:rgb(66, 99, 171)" target="_blank">http://georepublic.de</a></span><br>
</div>
<br>_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66, 99, 171)" target="_blank">daniel.kastl@georepublic.de</a><br>
Web: <a href="http://georepublic.de/" style="color:rgb(66, 99, 171)" target="_blank">http://georepublic.de</a></span><br>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66, 99, 171)" target="_blank">daniel.kastl@georepublic.de</a><br>
Web: <a href="http://georepublic.de/" style="color:rgb(66, 99, 171)" target="_blank">http://georepublic.de</a></span><br>
</div>