I am trying to code a type of buffer and I tried to find the source code of the buffer function in the ArcGIS and QGIS files in order to understand how it works in depth when it comes to creating buffer around a complex polygons. I would like to know how the vertex are generated and how the arcs close to the edge are created for optimal coverage.

If anyone has in depth knowledge of the source code of a buffer tool without too many external references to other functions, that would greatly help.


JTS probably has nice code in https://sourceforge.net/p/jts-topo-suite/code/HEAD/tree/trunk/jts/java/src/com/vividsolutions/jts/operation/buffer/

GEOS is a C port of JTS: https://trac.osgeo.org/geos/browser/trunk/src/operation/buffer

Most other open tools are build upon these. PostGIS and Shapely for example both use GEOS in the background.

QGIS also seems to be based on GEOS, at least https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.h and https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp look like that to me.

  • Thanks for finding the source code! I thought it would be in python since it's used for most tool. but this gives me a good occasion to learn about JAVA! – Al rl Nov 30 '16 at 18:38
  • All the Python tools I know use the (C) GEOS library in the background because it is much faster do to that than Python code could ever be :) Have fun! – bugmenot123 Nov 30 '16 at 19:59

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.