from django.contrib.gis.geos import Point point = Point(1, 1) buffered_point = point.buffer(2)
from django.contrib.gis.geos import LineString line = LineString([(-1, -1), (1, 1)]) buffered_line = line.buffer(1, 16)
from django.contrib.gis.geos import Polygon polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) buffered_polygon = polygon.buffer(100, 128, quadsegs=1, cap_style=3, join_style=3, mitre_limit=2)This creates a square polygon and creates a buffer with a radius of 100 meters. The second argument to buffer() is the number of segments used to approximate the curve of the buffer. The quadsegs, cap_style, join_style, and mitre_limit arguments modify the appearance of the buffer.