Construct a Polygon from a bounding box (4-tuple).
(cls, bbox)
| 56 | |
| 57 | @classmethod |
| 58 | def from_bbox(cls, bbox): |
| 59 | "Construct a Polygon from a bounding box (4-tuple)." |
| 60 | x0, y0, x1, y1 = bbox |
| 61 | for z in bbox: |
| 62 | if not isinstance(z, (float, int)): |
| 63 | return GEOSGeometry( |
| 64 | "POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))" |
| 65 | % (x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) |
| 66 | ) |
| 67 | return Polygon(((x0, y0), (x0, y1), (x1, y1), (x1, y0), (x0, y0))) |
| 68 | |
| 69 | # ### These routines are needed for list-like operation w/ListMixin ### |
| 70 | def _create_polygon(self, length, items): |