API
arcgis_oriented_imagery.data
Utilities for creating and managing ArcGIS oriented imagery datasets and for downloading camera-info CSV tables from S3. Key public functions:
-
get_new_camera_info_tables: download new/updated CSV camera info tables from S3 into a local working directory, with a manifest file to track previously downloaded items. Supports paginated S3 listings and configurable retry/backoff behavior when continuation tokens are missing.
-
process_camera_info_table: orchestrates renaming and creation of oriented imagery datasets using the other helper functions.
The module is designed to avoid import-time heavy dependencies where possible
and allows basic mocking of arcpy and boto3 for unit testing.
add_images_to_oriented_imagery_dataset(dataset_path, camera_info_table, imagery_category='360', camera_info_field_map=None, include_all_fields=False)
Add images to an existing Oriented Imagery Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
Union[str, Path]
|
The full path to the Oriented Imagery Dataset. |
required |
camera_info_table
|
Union[str, Path]
|
The path to the CSV table containing camera information. |
required |
imagery_category
|
Optional[Literal['Horizontal', 'Oblique', 'Nadir', '360', 'Inspection']]
|
The category of imagery being added. Default is '360'. |
'360'
|
camera_info_field_map
|
Optional[dict[str, str]]
|
A dictionary mapping the expected field names to the actual field names in the camera info table. |
None
|
include_all_fields
|
Optional[bool]
|
Whether all fields from input table, apart from the required schema, will be added to the dataset's attribute table. Default is False. |
False
|
Source code in src/arcgis_oriented_imagery/data.py
147 148 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
create_file_geodatabase(file_geodatabase_path)
Create the full path to an ArcGIS File Geodatabase if it does not already exist.
Note
If the full path does not exist, all necessary parent directories will be created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_geodatabase_path
|
Union[str, Path]
|
The full path to the File Geodatabase. |
required |
Source code in src/arcgis_oriented_imagery/data.py
create_oriented_imagery_dataset(dataset_path, spatial_reference=4326, has_z=True)
Create an Oriented Imagery Dataset at the specified path if it does not already exist.
Note
If the full path does not exist, all necessary parent directories will be created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
Union[str, Path]
|
The full path to the Oriented Imagery Dataset, including the File Geodatabase and Feature Dataset. |
required |
spatial_reference
|
Union[int, SpatialReference]
|
The spatial reference for the Oriented Imagery Dataset. This can be an EPSG code
(int) or an :class: |
4326
|
has_z
|
Optional[bool]
|
Whether the Oriented Imagery Dataset has a Z dimension. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The full path to the created Oriented Imagery Dataset. |
Source code in src/arcgis_oriented_imagery/data.py
get_new_camera_info_tables(s3_bucket_path, local_working_directory, manifest_file=None, max_retries=None, backoff_initial=None)
Download new camera info tables from an S3 bucket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s3_bucket_path
|
str
|
The S3 bucket path where camera info tables are stored. |
required |
local_working_directory
|
Union[str, Path]
|
The local directory to download the camera info tables to. |
required |
manifest_file
|
Optional[Union[str, Path]]
|
Optional path to a manifest file listing specific files to download. If not provided, one will be created in the local working directory. |
None
|
max_retries
|
Optional[int]
|
Optional maximum number of retries when S3 indicates more pages (IsTruncated=True)
but |
None
|
backoff_initial
|
Optional[float]
|
Optional initial backoff (seconds) for retry attempts. If None the value is read from AOI_S3_BACKOFF_INITIAL environment variable or defaults to 0.1. |
None
|
Configuration via environment variables
AOI_S3_MAX_RETRIES (int): default retry attempts when continuation token missing. AOI_S3_BACKOFF_INITIAL (float): initial backoff seconds for retries.
Source code in src/arcgis_oriented_imagery/data.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
process_camera_info_table(camera_info_table, working_directory, camera_info_field_map=None, output_dataset=None)
Process data defined in a camera info table CSV file. This includes renaming columns based on a provided mapping, and creating an output oriented imagery dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
camera_info_table
|
Union[str, Path]
|
The path to the CSV table containing camera information. |
required |
working_directory
|
Union[str, Path]
|
The directory where intermediate and output files will be stored. |
required |
camera_info_field_map
|
Optional[dict[str, str]]
|
A dictionary mapping the expected field names to the actual field names in the camera info table. |
None
|
output_dataset
|
Optional[Union[str, Path]]
|
Optional full path to the output Oriented Imagery Dataset. If not provided, a default path will be created in the working directory based on the input camera info table name. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The full path to the created Oriented Imagery Dataset. |
Source code in src/arcgis_oriented_imagery/data.py
arcgis_oriented_imagery.schema
Helpers for validating and renaming CSV/Tabular schemas used by the oriented imagery pipeline. Main public functions:
- validate_csv_schema: check that required columns are present in a CSV file.
- rename_dataframe_columns: rename columns in a pandas DataFrame using a mapping.
- rename_csv_columns: read a CSV, rename columns, and write the result.
The module uses local pandas imports and a logger to remain testable in environments without heavy GIS dependencies.
rename_csv_columns(input_csv_path, output_csv_path, column_mapping, warn_if_extra=True)
Rename columns in a CSV file based on the provided mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_csv_path
|
Union[str, Path]
|
The path to the input CSV file. |
required |
output_csv_path
|
Union[str, Path]
|
The path to the output CSV file. |
required |
column_mapping
|
dict[str, str]
|
Dictionary mapping old column names to new column names. |
required |
warn_if_extra
|
Optional[bool]
|
Whether to log a warning if extra columns are found in the input data. |
True
|
Source code in src/arcgis_oriented_imagery/schema.py
rename_dataframe_columns(input_data, column_mapping, warn_if_extra=True)
Rename columns in a Pandas DataFrame based on the provided mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
DataFrame
|
The input DataFrame. |
required |
column_mapping
|
dict[str, str]
|
Dictionary mapping old column names to new column names. |
required |
warn_if_extra
|
Optional[bool]
|
Whether to log a warning if extra columns are found in the input data. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Pandas DataFrame with renamed columns. |
Source code in src/arcgis_oriented_imagery/schema.py
validate_csv_schema(csv_path, required_columns, fail_if_extra=False)
Validate that the CSV file contains the required columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
Union[str, Path]
|
The path to the CSV file. |
required |
required_columns
|
list[str]
|
A list of required column names. |
required |
fail_if_extra
|
bool
|
Whether to fail if extra columns are found. |
False
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the CSV schema is valid, False otherwise. |