0
# Utility Functions
1
2
Helper functions for common geospatial operations including bounds calculation, driver information, and version management.
3
4
## Capabilities
5
6
### Bounds Calculation
7
8
```python { .api }
9
def bounds(ob):
10
"""
11
Returns a (minx, miny, maxx, maxy) bounding box.
12
13
Parameters:
14
- ob: dict, feature record or geometry object
15
16
Returns:
17
tuple: (minx, miny, maxx, maxy) bounding box coordinates
18
"""
19
```
20
21
### Version Information
22
23
```python { .api }
24
def show_versions():
25
"""Display version information for debugging."""
26
27
# Module constants
28
__version__: str # Fiona version (e.g., "1.10.1")
29
__gdal_version__: str # GDAL version string
30
gdal_version: tuple # GDAL version tuple
31
```
32
33
#### Usage Examples
34
35
```python
36
import fiona
37
from fiona import bounds
38
39
# Calculate bounds from geometry
40
point_geom = {'type': 'Point', 'coordinates': [-122.4, 37.8]}
41
point_bounds = bounds(point_geom)
42
print(f"Point bounds: {point_bounds}")
43
44
# Calculate bounds from feature
45
feature = {
46
'geometry': {'type': 'Point', 'coordinates': [0, 0]},
47
'properties': {'name': 'Origin'}
48
}
49
feature_bounds = bounds(feature)
50
51
# Get version information
52
print(f"Fiona version: {fiona.__version__}")
53
print(f"GDAL version: {fiona.__gdal_version__}")
54
print(f"GDAL tuple: {fiona.gdal_version}")
55
56
# Show detailed version info for debugging
57
fiona.show_versions()
58
```