[postgis-users] Shortest path around polygons

Daniel Kastl orkney at gmx.de
Thu Jun 25 17:56:29 PDT 2009


Hi,

First I agree with Ralf and would also use pgRouting for this.

I think you have a network table and a polygon table, right?
When you search for the shortest path from A to B with pgRouting, you 
usually won't load the complete data but a bounding box area that 
includes A and B.
You could then further exclude network links that are within your 
polygons and search the shortest path through your "reduced" network.

Daniel





tommy408 schrieb:
> Thank you for your help.
> If my polygon table is huge,  it would have to consider all the polygon in
> space?  Is there a way I can narrow down only polygons are that in the way
> between point A and B?
>
>
>
> Suhr, Ralf wrote:
>   
>> Solving your problem is not realy hard but time expensive.
>>  - install pgRouting
>>  - create one table for the polygons
>>  - create one table for holding linestrings
>>  - write a function that:
>>    - build all possible lines in one polygon (makeline from cross join
>> points from polygon)
>>    - remove lines wich are outside the polygon
>>    - write lines with extra attribute polygon_id in the linestring table
>>  - run add_vertices (pgRouting function)
>>  - create temporary table for your "two points" (linestring geometry)
>>  - rerun the function for creating linstrings with the two points and all
>> polygon points
>>  - finaly run shortest_path( join two tables )
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] Im Auftrag von
>> tommy408
>> Gesendet: Donnerstag, 25. Juni 2009 15:35
>> An: postgis-users at postgis.refractions.net
>> Betreff: [postgis-users] Shortest path around polygons
>>
>>
>>
>> I'm really new to PostGIS.  I need to solve this problem.  Find the
>> shortest path around polygons from point A to point B.  
>>
>> Here is a better description:  http://alienryderflex.com/shortest_path/
>>
>> How can I do it with PostGIS.  Or if you can give me some hints to narrow
>> my search.
>>
>> Thank you.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Shortest-path-around-polygons-tp24203378p24203378.html
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> postgis-users mailing list postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>     
>
>   




More information about the postgis-users mailing list