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.
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?