I am looking for a solution to retrieve the geometry(ies) from a polygon/multipolygon within a bounding box in a GeoDjango application.

The application I am developing has a requirement to serve out tiles of geographical data, and many of our geometries are very large and span across multiple tiles. To reduce the payload of each tile I would like to splice(cut) a geometry shape(s) from a bounding box.

I am storing Planet.OSM data in a PostGIS database.

Any suggestions would be greatly appreciated!


1 Answer 1


If you are working with a GeoQuerySet, you can call the intersection() method with a geometry argument (e.g. your bounding box) to return the geometries from your GeoQuerySet that are intersected by the geometry (bounding box) you provided. If you need to use a raw query, try the corresponding ST_Intersection method of PostGIS. In either case, you should initially filter your results to those that are intersected by the bounding box. To quote the ST_Intersection reference:

ST_Intersection in conjunction with ST_Intersects is very useful for clipping geometries such as in bounding box, buffer, region queries where you only want to return that portion of a geometry that sits in a country or region of interest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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