Did I find the right examples for you? yes no

# MAVProxy.modules.lib.mp_util.polygon_bounds

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)
```return bounding box of a polygon in (x,y,width,height) form
```

```        def polygon_bounds(points):
'''return bounding box of a polygon in (x,y,width,height) form'''
(minx, miny) = (points[0][0], points[0][1])
(maxx, maxy) = (minx, miny)
for p in points:
minx = min(minx, p[0])
maxx = max(maxx, p[0])
miny = min(miny, p[1])
maxy = max(maxy, p[1])
return (minx, miny, maxx-minx, maxy-miny)
```

```	if opts.boundary:
bounds = mp_util.polygon_bounds(boundary)
lat = bounds[0]+bounds[2]
lon = bounds[1]
```

```	if opts.boundary:
bounds = mp_util.polygon_bounds(boundary)
lat = bounds[0]+bounds[2]
lon = bounds[1]
```

```        print("No points to plot")
return
bounds = mp_util.polygon_bounds(path[0])
(lat, lon) = (bounds[0]+bounds[2], bounds[1])
(lat, lon) = mp_util.gps_newpos(lat, lon, -45, 50)
```

```        print("No points to plot")
return
bounds = mp_util.polygon_bounds(path[0])
(lat, lon) = (bounds[0]+bounds[2], bounds[1])
(lat, lon) = mp_util.gps_newpos(lat, lon, -45, 50)
```

```        self.colour = colour
self.linewidth = linewidth
self._bounds = mp_util.polygon_bounds(self.points)

def bounds(self):
```

```        self.colour = colour
self.linewidth = linewidth
self._bounds = mp_util.polygon_bounds(self.points)
self._pix_points = []
self._selected_vertex = None
```

```        self.fenceloader.target_system = self.target_system
bounds = mp_util.polygon_bounds(points)
(lat, lon, width, height) = bounds
center = (lat+width/2, lon+height/2)
```

```        self.fenceloader.target_system = self.target_system