GPS Extraction Configuration
Location:
config/extract-gps.yaml
Purpose: Configuration file for extracting GPS coordinates from images and visualizing detection results with geographic information. This config is used for the extract-gps-coordinates visualization command.
Configuration Structure
Complete Parameter Reference
# Visualization Configuration
# This file contains all parameters needed for visualization commands
labelstudio:
url: http://localhost:8080
api_key: null # <<< TO change HERE
download_resources: false
project_id: null
json_path: null # <<< TO change HERE
dotenv_path: .env
parse_ls_config: true
ls_xml_config: null
csv_output_path: D:\PhD\Harvard Kruger River Surveys\20231017_LetabaRiver_BasaltA\annotations\detections_v2.csv
detection_type: "annotations" # annotations, predictions
# Flight Specifications
flight_specs:
sensor_height: 15.6 # mm
focal_length: 16.0 # mm
flight_height: 120.0 # meters
# Logging Configuration
logging:
verbose: false
log_file: null # Will use default log path if null
Parameter Descriptions
labelstudio
Label Studio integration configuration for importing annotations or predictions.
url(string): Label Studio server URLapi_key(string): Label Studio API key for authentication (set in.envfile)download_resources(bool): Whether to download images from Label Studioproject_id(int, optional): Label Studio project ID to import fromjson_path(string, optional): Path to Label Studio JSON export filedotenv_path(string): Path to.envfile containing environment variablesparse_ls_config(bool): Whether to parse Label Studio XML configurationls_xml_config(string, optional): Path to Label Studio XML configuration file
csv_output_path
- Type: string
- Description: Path where GPS coordinates and detection data will be exported as CSV
detection_type
- Type: string
- Options:
"annotations","predictions" - Description: Type of detections to process. Use
"annotations"for ground truth data,"predictions"for model outputs
flight_specs
Flight and camera specifications for geographic calculations.
sensor_height(float): Camera sensor height in millimetersfocal_length(float): Lens focal length in millimetersflight_height(float): Flight altitude in meters
logging
Logging configuration.
verbose(bool): Enable verbose logging outputlog_file(string, optional): Path to log file. Ifnull, uses default log path
Example Configurations
Extract GPS from Label Studio Annotations
labelstudio:
url: http://localhost:8080
api_key: ${LABEL_STUDIO_API_KEY} # From .env file
download_resources: false
project_id: 1
dotenv_path: .env
parse_ls_config: true
csv_output_path: results/gps_coordinates.csv
detection_type: "annotations"
flight_specs:
sensor_height: 15.6
focal_length: 16.0
flight_height: 120.0
logging:
verbose: true
log_file: null
Extract GPS from Predictions File
labelstudio:
json_path: results/predictions.json
download_resources: false
csv_output_path: results/predictions_gps.csv
detection_type: "predictions"
flight_specs:
sensor_height: 24.0
focal_length: 35.0
flight_height: 180.0
logging:
verbose: false
Extract GPS with Custom Label Studio Config
labelstudio:
url: http://localhost:8080
api_key: null
project_id: 2
ls_xml_config: configs/label_studio_config.xml
parse_ls_config: true
csv_output_path: results/annotations_gps.csv
detection_type: "annotations"
flight_specs:
sensor_height: 15.6
focal_length: 16.0
flight_height: 120.0
Best Practices
- API Key Security: Store Label Studio API key in
.envfile, not in the config file - Output Paths: Use absolute paths or paths relative to project root for
csv_output_path - Flight Specs: Ensure flight specifications match the actual survey parameters for accurate GPS calculations
- Detection Type: Use
"annotations"for ground truth data analysis,"predictions"for model evaluation - Label Studio: If using Label Studio, ensure the server is running and accessible
- CSV Output: The output CSV will contain columns for image paths, GPS coordinates, and detection information
Troubleshooting
Label Studio Connection Failed
Issue: Cannot connect to Label Studio server
Solutions:
- Verify Label Studio is running:
scripts/launch_labelstudio.bat - Check
urlis correct (default:http://localhost:8080) - Verify API key is set correctly in
.envfile - Check network connectivity
API Key Not Found
Issue: Label Studio API key error
Solutions:
- Set
LABEL_STUDIO_API_KEYin.envfile - Or set
api_keydirectly in config (not recommended for production) - Verify API key has correct permissions
GPS Coordinates Missing
Issue: GPS coordinates not extracted from images
Solutions:
- Verify images have EXIF GPS data
- Check image file formats support EXIF (JPEG, TIFF)
- Ensure images were taken with GPS-enabled camera
- Check
flight_specsare correct for geographic calculations
CSV Output Not Created
Issue: CSV file not generated
Solutions:
- Verify
csv_output_pathdirectory exists or can be created - Check file permissions for output directory
- Ensure input data (annotations/predictions) is valid
- Check logs for error messages