Need to Implement Spatial Analysis in Postgresql. Can Any one guide me to accomplish the spatial analysis eg) 2 km buffer for road network layer.
-
1what sort of spatial analysis?– Ian Turton ♦Sep 18, 2013 at 6:09
2 Answers
SELECT x.* from table road as r , x where ST_Intersects(STBuffer(r.the_geom, 2000), x.the_geom) IS TRUE
assuming that you want all colums from table x intersect road+2km buffer area (and used projection uses meters) . You can also use faster ST_DWithIN(r.geom, x.geom, 2000) (see Postgis Manual)
I cant guess what kind analysis you want to after that but that should point you into right direction.
If you are trying to create a buffered featured, ST_Buffer will work. If you are trying to select other features based upon a distance of your road network, you should consider using ST_DWithin, both as @simplexio suggested.
See similar questions that should help you out:
- When should I use ST_Buffer?
- How to select all points within a circle in PostGIS?
- PostGIS ST_Buffer Radius Help
If you are just getting started with PostGIS, I think you would probably benefit by going through the material presented in other questions already on GIS.StackExchange.
- How do I get started with PostGIS
- Spatial databases learning resources for newbies
- What are some good introductory books or articles about Open Source GIS for students coming from an ESRI background?
Additionally, purchasing & reading the book "PostGIS in Action" would be helpful, as well as reading the many helpful tutorials on the publishers blog at http://www.bostongis.com/