The bounding box

An important concept in vector-based analysis is the bounding box. This plays into many aspects of geospatial processing, including spatial indexing. A box shape is computationally much easier to search and manipulate than an irregular LineString or Polygon. Putting things into a box first and then fine tuning specific to its shape later is a common pattern for efficient searching.

A bounding box is simply the smallest rectangle that will contain the vector object in question. This is often called a Minimum Bounding Rectangle (MBR) and is the basis for many geospatial search algorithms. The following image shows an MBR for a collection of polygons:

Minimum bounding rectangle for a set of polygons. Source: Wikipedia commons

An MBR can be determined with shapely using the bounds method:

#Import linestring class
from shapely.geometry import LineString

#create a linestring from a series of points
MBRline = LineString([(1, 0), (1, 1),(3,5),(2,2)])

#determine MBR bounding box
MBRboundingBox = MBRline.bounds

#output results
MBRboundingBox

#(1.0, 0.0, 3.0, 5.0)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.46.36