I would like to creat buffers in a automate form and no matter the way (e.g. script, batches and etc) I am asking if anybody here knows how to do it or if are there scripts ready to do it.

My situation is: I have two vectors layers (a point, representing a station, and roads. From the point I need to creat circular buffers that intersect the roads and after calculate the lengths of intersected roads.

No matter the solution I would like the simple, like batch process, or built in scripts.


If 'no matter way' it's always good to perform this kind of calculations on spatial-enabled database - PostgreSQL + PostGIS for example... aspecially if it's not only one calculation you're going to make.

SHP2PGSQL let's you import shp into database with just one command, after it you can connect to it via qgis and make many different calculations with sql query, or make another scripts to write calculations to file and many more.

If it's acceptable way for you please comment my answer so I can prepare for you ready to use commands and queries. If it's not hope someone will give you answer based on scripts in qgis.


  1. First step is instalation of PostgreSQL+PostGIS. All needed documentation is on the site of project

  2. Second thing is importing shapefiles. There is few ways how to do this, but the quickest and easyiest way is osm2pgsql - simple application that comes with postgis. After you install postgis, create database and spatialy anable it only thing you hav e to to is write one command. Cheatsheet with examples is aviable at bostongis site. If you prefere GUI ways you can connect to database with QGIS and import your files. Few more solutions of this step you'll find here

  3. One you have a database with your data inside you can make your calculations via SQL query. You will need some postgis functions like st_buffer, st_intersection st_union and st_length

  • Perfect! For me it will be perfect because I need generate the buffers. Could you you tell step by step how to make the process? – Paulo Pimenta May 10 '14 at 18:38
  • Excuse me, but i was at the trip few days... Keep me posted about your progress so i could clarify for you problematical steps – Jendrusk May 12 '14 at 17:19
  • I can do the generating using a batch made by SAGA software. If you would like I post here what I do. So, Now I am in doubt in the process to cut the buffers. Do you know how to do it using the batch also made by SAGA? – Paulo Pimenta May 15 '14 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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