Export API
Export modules — GeoTIFF, CSV, GeoJSON, QGIS project generation.
export_cog(data, output_path, **kwargs)
Export as Cloud-Optimized GeoTIFF (COG).
COGs enable efficient web streaming — stakeholders can explore visualizations without GIS software.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
2D or 3D array |
required |
output_path
|
str | Path
|
Output .tif path |
required |
**kwargs
|
Any
|
Passed to export_geotiff |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the written COG |
Source code in dig/export/geotiff.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
export_csv(data, output_path, x_coords=None, y_coords=None, depth_labels=None)
Export processed data as CSV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
2D (rows, cols) or 3D (bands, rows, cols) array |
required |
output_path
|
str | Path
|
Output .csv path |
required |
x_coords
|
ndarray | None
|
X coordinates for each column |
None
|
y_coords
|
ndarray | None
|
Y coordinates for each row |
None
|
depth_labels
|
list[str] | None
|
Labels for each band/depth |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the written CSV |
Source code in dig/export/csv_export.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
export_geojson(features, output_path, crs_epsg=4326)
Export anomaly detections or survey boundaries as GeoJSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[dict]
|
List of GeoJSON Feature objects |
required |
output_path
|
str | Path
|
Output .geojson path |
required |
crs_epsg
|
int
|
EPSG code |
4326
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the written GeoJSON |
Source code in dig/export/geojson.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
export_geotiff(data, output_path, crs_epsg=4326, origin_easting=0.0, origin_northing=0.0, pixel_size=1.0, rotation_deg=0.0, band_descriptions=None, nodata=None)
Export processed geophysical data as a georeferenced GeoTIFF.
Supports multi-band export (each band = one depth slice).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
2D (rows, cols) or 3D (bands, rows, cols) array |
required |
output_path
|
str | Path
|
Output .tif path |
required |
crs_epsg
|
int
|
EPSG code for the CRS |
4326
|
origin_easting
|
float
|
Easting of grid origin |
0.0
|
origin_northing
|
float
|
Northing of grid origin |
0.0
|
pixel_size
|
float
|
Pixel resolution in CRS units |
1.0
|
rotation_deg
|
float
|
Clockwise rotation from north |
0.0
|
band_descriptions
|
Optional[list[str]]
|
Per-band description strings |
None
|
nodata
|
Optional[float]
|
NoData value (auto-detected if None) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the written GeoTIFF |
Source code in dig/export/geotiff.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
generate_qgz(raster_paths, output_path, project_title='DIG Geophysical Survey', crs_epsg=4326)
Generate a QGIS project file (.qgs XML).
Configures a complete QGIS 3.x project with layer symbology, global extent, and proper project tree structuring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster_paths
|
list[str]
|
Paths to GeoTIFF files to include |
required |
output_path
|
str | Path
|
Output .qgs path |
required |
project_title
|
str
|
Project title |
'DIG Geophysical Survey'
|
crs_epsg
|
int
|
EPSG code for the project CRS |
4326
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the written .qgs file |
Source code in dig/export/qgis.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |