Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using pgrouting to get shortest route. Now i want to get point that comes in buffer of 5km along router.Point is other shape file. route is using road shape so any one give me idea for same.

share|improve this question
1  
Are you asking how to get a buffer around the LINESTRING from the result of your shortest route query? Please consider clarifying your question. –  Steve Horn Mar 9 '12 at 16:24
    
NO i am asking how to get all places(i.e point shapefile in postgres) that comes in buffer of road(which is other shape file. So i wnat postgres query for same –  Pari Mar 10 '12 at 6:57
    
Please consider accepting the answer. –  underdark May 10 '12 at 6:36
add comment

1 Answer

Pseudocode:

SELECT * 
FROM points_table pt
WHERE ST_Intersects(pt.the_geom, SELECT ST_Buffer(ST_Union(w.the_geom), 5000)
                    FROM shortest_path('
                        SELECT gid as id,
                             source::integer,
                             target::integer,
                             length::double precision as cost
                            FROM ways',
                        5700, 6733, false, false) sp
                    INNER JOIN ways w
                        ON w.gid = sp.edge_id);
  • Use PostGIS ST_Union to get a LINESTRING which represents each of the line segments combined to get your route.
  • ST_Buffer will buffer the linestring 5km.
  • ST_Intersects retrieves all the points within the buffered zone.
share|improve this answer
    
Thanks it works –  Pari Mar 14 '12 at 4:17
1  
Mark as answer? –  Steve Horn Mar 14 '12 at 19:17
    
Value 5000 depends totally on your shapefile vertex length columns. –  Pari Mar 16 '12 at 9:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.