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 shapefile. Route is using road shape so any one give me idea for same.
Asked
Active
Viewed 569 times
3
-
1Are 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 09 '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 06:57
-
@ Steve Horn may I know the answer for your words in the comment? because I am in stuck with that problem. – Karthik Jun 12 '19 at 08:18
1 Answers
1
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_Unionto get a LINESTRING which represents each of the line segments combined to get your route. ST_Bufferwill buffer the linestring 5km.ST_Intersectsretrieves all the points within the buffered zone.
Steve Horn
- 728
- 2
- 7
- 12