cannot pass image geolocation file (geo.txt) into project

very likely an ignorant question here… but when using pyodm, I am unable to pass or have odm recognize an image geolocation file (geo.txt). This works using the normal webodm and CLI approaches as long as I have it in the root of my project folder, but cannot resolve this with pyodm. When creating a task I used the --geo argument passing the geo.txt absolute path with no success either.

Any help would be much appreciated!

import glob
import os
from pyodm import Node, exceptions
 
node = Node("localhost", 3000)
try:
    # Get all JPG files in directory
    files = glob.glob("*.JPG") + glob.glob("*.jpg") + glob.glob("*.JPEG") + glob.glob("*.jpeg") + glob.glob("*.txt")
    geolist = glob.glob("*geo.txt")
 
    print("Uploading images...")
    task = node.create_task(files, {'orthophoto-resolution': 15, 'ignore-gsd': True, 'gps-accuracy': 0.05, 'use-hybrid-bundle-adjustment': True, 'fast-orthophoto': True, 'skip-3dmodel': True, 'time': True, 'geo': geolist})
    print(task.info())
 
    try:
        def print_status(task_info):
            msecs = task_info.processing_time
            seconds = int((msecs / 1000) % 60)
            minutes = int((msecs / (1000 * 60)) % 60)
            hours = int((msecs / (1000 * 60 * 60)) % 24)
            print("Task is running: %02d:%02d:%02d" % (hours, minutes, seconds), end="\r")
        task.wait_for_completion(status_callback=print_status)
 
        print("Task completed, downloading results...")
 
        # Retrieve results
        def print_download(progress):
            print("Download: %s%%" % progress, end="\r")
        task.download_assets(outputdir, progress_callback=print_download)
        print("Assets saved in output/results directory")
    except exceptions.TaskFailedError as e:
        print("\n".join(task.output()))
except exceptions.NodeConnectionError as e:
    print("Cannot connect: %s" % e)
except exceptions.OdmError as e:
    print("Error: %s" % e)
1 Like

No need to specify the --geo option; simply naming your file geo.txt and adding its path to your files list should do the trick.

1 Like

Hi Piero - really appreciate the reply. That is what I tried initially but it was being recognized as being a gcp file, even though it’s named “geo.txt”.

Mm, were you running the latest version of ODM/NodeODM? The latest version of NodeODM shouldn’t even expose the geo option: NodeODM/odmInfo.js at 1aae1e4957bd174079151d851dae23ab8b1d3c1d · OpenDroneMap/NodeODM · GitHub

here is the node.info…

{‘version’: ‘2.1.2’, ‘task_queue_count’: 0, ‘total_memory’: 18880630784, ‘available_memory’: 18163216384, ‘cpu_cores’: 4, ‘max_images’: None, ‘max_parallel_tasks’: 1, ‘engine’: ‘odm’, ‘engine_version’: ‘2.3.3’, ‘odm_version’: ‘?’}

Uploading images…
{‘uuid’: ‘9484e3d0-4b1f-45e6-991d-cb9242bb2711’, ‘name’: ‘Task of 2021-01-03T16:18:57.658Z’, ‘date_created’: datetime.datetime(2021, 1, 3, 16, 18, 57), ‘processing_time’: 1, ‘status’: <TaskStatus.RUNNING: 20>, ‘last_error’: ‘’, ‘options’: [{‘name’: ‘use-hybrid-bundle-adjustment’, ‘value’: True}, {‘name’: ‘skip-3dmodel’, ‘value’: True}, {‘name’: ‘ignore-gsd’, ‘value’: True}, {‘name’: ‘fast-orthophoto’, ‘value’: True}, {‘name’: ‘orthophoto-resolution’, ‘value’: 15}, {‘name’: ‘gps-accuracy’, ‘value’: 0.05}], ‘images_count’: 6, ‘progress’: 0, ‘output’: []}
[INFO] Fast orthophoto is turned on, automatically setting --skip-3dmodel
[INFO] Initializing ODM - Sun Jan 03 16:18:58 2021
[INFO] ==============
[INFO] build_overviews: False
[INFO] camera_lens: auto
[INFO] cameras: {}
[INFO] crop: 3
[INFO] debug: False
[INFO] dem_decimation: 1
[INFO] dem_euclidean_map: False
[INFO] dem_gapfill_steps: 3
[INFO] dem_resolution: 5
[INFO] depthmap_resolution: 640
[INFO] dsm: False
[INFO] dtm: False
[INFO] end_with: odm_report
[INFO] fast_orthophoto: True
[INFO] feature_quality: high
[INFO] feature_type: sift
[INFO] force_gps: False
[INFO] gcp: /var/www/data/9484e3d0-4b1f-45e6-991d-cb9242bb2711/gcp/geo.txt
[INFO] geo: None
[INFO] gps_accuracy: 0.05
[INFO] ignore_gsd: True
[INFO] matcher_distance: 0
[INFO] matcher_neighbors: 8
[INFO] matcher_type: flann
[INFO] max_concurrency: 4
[INFO] merge: all
[INFO] mesh_octree_depth: 11
[INFO] mesh_size: 200000
[INFO] min_num_features: 8000
[INFO] name: 9484e3d0-4b1f-45e6-991d-cb9242bb2711
[INFO] opensfm_depthmap_method: PATCH_MATCH
[INFO] opensfm_depthmap_min_consistent_views: 3
[INFO] opensfm_depthmap_min_patch_sd: 1
[INFO] optimize_disk_space: False
[INFO] orthophoto_compression: DEFLATE
[INFO] orthophoto_cutline: False
[INFO] orthophoto_no_tiled: False
[INFO] orthophoto_png: False
[INFO] orthophoto_resolution: 15.0
[INFO] pc_classify: False
[INFO] pc_csv: False
[INFO] pc_ept: False
[INFO] pc_filter: 2.5
[INFO] pc_las: False
[INFO] pc_quality: medium
[INFO] pc_rectify: False
[INFO] pc_sample: 0
[INFO] primary_band: auto
[INFO] project_path: /var/www/data
[INFO] radiometric_calibration: none
[INFO] rerun: None
[INFO] rerun_all: False
[INFO] rerun_from: None
[INFO] resize_to: 2048
[INFO] skip_3dmodel: True
[INFO] skip_band_alignment: False
[INFO] sm_cluster: None
[INFO] smrf_scalar: 1.25
[INFO] smrf_slope: 0.15
[INFO] smrf_threshold: 0.5
[INFO] smrf_window: 18.0
[INFO] split: 999999
[INFO] split_overlap: 150
[INFO] texturing_data_term: gmi
[INFO] texturing_outlier_removal_type: gauss_clamping
[INFO] texturing_skip_global_seam_leveling: False
[INFO] texturing_skip_local_seam_leveling: False
[INFO] texturing_tone_mapping: none
[INFO] tiles: False
[INFO] time: False
[INFO] use_3dmesh: False
[INFO] use_exif: False
[INFO] use_fixed_camera_params: False
[INFO] use_hybrid_bundle_adjustment: True
[INFO] use_opensfm_dense: False
[INFO] verbose: False
[INFO] ==============
[INFO] Running dataset stage
[INFO] Loading dataset from: /var/www/data/9484e3d0-4b1f-45e6-991d-cb9242bb2711/images
[INFO] Loading 6 images
[INFO] Wrote images database: /var/www/data/9484e3d0-4b1f-45e6-991d-cb9242bb2711/images.json
[INFO] Found 6 usable images
[INFO] Parsing SRS header: EPSG:26904
[WARNING] Malformed GCP line: DSC04234.JPG 667018.568 6581111.428 325.163884
[WARNING] Malformed GCP line: DSC04235.JPG 667125.5328 6581103.183 324.700938
.—
.—
.—
[WARNING] Malformed GCP line: DSC04864.JPG 669465.478 6581997.929 330.889978
[WARNING] Malformed GCP line: DSC04865.JPG 669569.9596 6582005.862 330.231767
Traceback (most recent call last):
File “/code/run.py”, line 69, in
app.execute()
File “/code/stages/odm_app.py”, line 83, in execute
self.first_stage.run()
File “/code/opendm/types.py”, line 342, in run
self.process(self.args, outputs)
File “/code/stages/dataset.py”, line 157, in process
reconstruction.georeference_with_gcp(tree.odm_georeferencing_gcp,
File “/code/opendm/types.py”, line 79, in georeference_with_gcp
raise RuntimeError(“This GCP file does not have any entries. Are the entries entered in the proper format?”)
RuntimeError: This GCP file does not have any entries. Are the entries entered in the proper format?

Mm now that I think about it, this might be a bug.

I’ll have a look at this in the next few days.

2 Likes

thanks!

1 Like

This should be fixed with Add support for geo files by pierotofy · Pull Request #140 · OpenDroneMap/NodeODM · GitHub

After updating, the API version should read 2.1.3. With it, you can pass a geo.txt file along with the images and it should be picked up. :+1:

Thanks for reporting the problem!

3 Likes

that did the trick… thanks again!

3 Likes

Can you post a sample geo.txt format for better understanding of what to do

1 Like

Indeed, see if this link helps:
https://docs.opendronemap.org/geo.html

1 Like

Hello there. I know this is a VERY ignorant question (sigh…) but am trying to figure out exactly what the geo.txt file format should be. It would be great if a sample txt file could be posted here. Thanks!

1 Like

Welcome!

Check the documentation:
Image Geolocation Files — OpenDroneMap 2.6.0 documentation

2 Likes

Hi
Still having issue with geo.txt on WebODM.
I upload with the images (using “select images and GCP” button) the geo.txt file and am getting

[INFO] Wrote images database: /var/www/data/369971ac-b893-4f7e-96cb-17de0f734bb3/images.json
[INFO] Found 7 usable images
[WARNING] GPS position not available for 4_05_47_nir.jpg
[WARNING] GPS position not available for 4_07_49_nir.jpg
[WARNING] GPS position not available for 4_08_50_nir.jpg
[WARNING] GPS position not available for 4_10_52_nir.jpg
[WARNING] GPS position not available for 4_11_53_nir.jpg
[WARNING] GPS position not available for 4_06_48_nir.jpg
[WARNING] GPS position not available for 4_09_51_nir.jpg
[WARNING] Could not generate coordinates file. The orthophoto will not be georeferenced.

I also tried to not upload it to WebODM and leave it in the images folder hoping it would be recognized somehow - but same result.

I only tried a few images to see if they get recognized - hence the short list.

Is it something in the formatting? or they way I upload to webodm?

Tnx !
This the webdom processing node configuration

This is the actual geo.txt

EPSG:4326
3_01_01_rgb.jpg	-97.27001041	20.15171336	1038.669
3_02_02_rgb.jpg	-97.26840665	20.15197893	1037.413
3_03_03_rgb.jpg	-97.26675212	20.15224991	1038.912
3_04_04_rgb.jpg	-97.26513564	20.15251736	1043.366
3_05_05_rgb.jpg	-97.26350936	20.15278334	1043.746
3_06_06_rgb.jpg	-97.26188662	20.15312436	1043.271
3_07_07_rgb.jpg	-97.2602799	20.15348427	1043.57
3_08_08_rgb.jpg	-97.25863824	20.15382944	1047.104
3_09_09_rgb.jpg	-97.25703344	20.15416222	1047.975
3_10_10_rgb.jpg	-97.25538835	20.15448802	1046.228
3_11_11_rgb.jpg	-97.25375052	20.15478051	1042.13
3_12_12_rgb.jpg	-97.25212231	20.15507079	1039.275
3_13_13_rgb.jpg	-97.25050227	20.15536343	1040.93
3_14_14_rgb.jpg	-97.24889706	20.1556766	1040.383
2_14_15_rgb.jpg	-97.24965304	20.15978527	1058.798
2_13_16_rgb.jpg	-97.25130038	20.15948723	1059.411
2_12_17_rgb.jpg	-97.252923	20.15923314	1055.168
2_11_18_rgb.jpg	-97.25455214	20.15894875	1053.898
2_10_19_rgb.jpg	-97.2561973	20.15862039	1058.193
2_09_20_rgb.jpg	-97.25784675	20.15827035	1060.972
2_08_21_rgb.jpg	-97.25951492	20.15791984	1060.36
2_07_22_rgb.jpg	-97.26112738	20.15765099	1057.069
2_06_23_rgb.jpg	-97.26277413	20.15737636	1054.897
2_05_24_rgb.jpg	-97.26440985	20.15706882	1056.203
2_04_25_rgb.jpg	-97.2660237	20.15675501	1060.217
2_03_26_rgb.jpg	-97.26764097	20.15645868	1062.1
2_02_27_rgb.jpg	-97.26929584	20.15615279	1058.861
2_01_28_rgb.jpg	-97.27090381	20.15586054	1058.265
1_01_29_rgb.jpg	-97.27143292	20.16006881	1033.425
1_02_30_rgb.jpg	-97.26985259	20.16034492	1033.532
1_03_31_rgb.jpg	-97.26827657	20.16064617	1032.934
1_04_32_rgb.jpg	-97.26667318	20.16096077	1030.519
1_05_33_rgb.jpg	-97.26509884	20.16124494	1029.813
1_06_34_rgb.jpg	-97.26349861	20.16151471	1027.875
1_07_35_rgb.jpg	-97.26194962	20.16177729	1024.293
1_08_36_rgb.jpg	-97.26038078	20.16204487	1021.591
1_09_37_rgb.jpg	-97.25878968	20.16231127	1019.147
1_10_38_rgb.jpg	-97.25713024	20.16264419	1019.019
1_11_39_rgb.jpg	-97.2555888	20.1629822	1022.23
1_12_40_rgb.jpg	-97.25400601	20.16331565	1028.975
1_13_41_rgb.jpg	-97.25241155	20.16362007	1031.193
1_14_42_rgb.jpg	-97.25082216	20.16391703	1029.773
4_01_43_rgb.jpg	-97.26158968	20.1653358	1026.504
4_02_44_rgb.jpg	-97.2611893	20.16382023	1024.515
4_03_45_rgb.jpg	-97.26082428	20.16231734	1025.158
4_04_46_rgb.jpg	-97.26053104	20.16082946	1026.071
4_05_47_rgb.jpg	-97.26020999	20.15930396	1027.525
4_06_48_rgb.jpg	-97.2599087	20.15778896	1029.795
4_07_49_rgb.jpg	-97.2596749	20.15632779	1034.163
4_08_50_rgb.jpg	-97.25939464	20.15483963	1035.672
4_09_51_rgb.jpg	-97.25908332	20.15340509	1037.295
4_10_52_rgb.jpg	-97.25877959	20.15189465	1036.719
4_11_53_rgb.jpg	-97.25849937	20.15042563	1032.958
3_01_01_nir.jpg	-97.27001041	20.15171336	1038.669
3_02_02_nir.jpg	-97.26840665	20.15197893	1037.413
3_03_03_nir.jpg	-97.26675212	20.15224991	1038.912
3_04_04_nir.jpg	-97.26513564	20.15251736	1043.366
3_05_05_nir.jpg	-97.26350936	20.15278334	1043.746
3_06_06_nir.jpg	-97.26188662	20.15312436	1043.271
3_07_07_nir.jpg	-97.2602799	20.15348427	1043.57
3_08_08_nir.jpg	-97.25863824	20.15382944	1047.104
3_09_09_nir.jpg	-97.25703344	20.15416222	1047.975
3_10_10_nir.jpg	-97.25538835	20.15448802	1046.228
3_11_11_nir.jpg	-97.25375052	20.15478051	1042.13
3_12_12_nir.jpg	-97.25212231	20.15507079	1039.275
3_13_13_nir.jpg	-97.25050227	20.15536343	1040.93
3_14_14_nir.jpg	-97.24889706	20.1556766	1040.383
2_14_15_nir.jpg	-97.24965304	20.15978527	1058.798
2_13_16_nir.jpg	-97.25130038	20.15948723	1059.411
2_12_17_nir.jpg	-97.252923	20.15923314	1055.168
2_11_18_nir.jpg	-97.25455214	20.15894875	1053.898
2_10_19_nir.jpg	-97.2561973	20.15862039	1058.193
2_09_20_nir.jpg	-97.25784675	20.15827035	1060.972
2_08_21_nir.jpg	-97.25951492	20.15791984	1060.36
2_07_22_nir.jpg	-97.26112738	20.15765099	1057.069
2_06_23_nir.jpg	-97.26277413	20.15737636	1054.897
2_05_24_nir.jpg	-97.26440985	20.15706882	1056.203
2_04_25_nir.jpg	-97.2660237	20.15675501	1060.217
2_03_26_nir.jpg	-97.26764097	20.15645868	1062.1
2_02_27_nir.jpg	-97.26929584	20.15615279	1058.861
2_01_28_nir.jpg	-97.27090381	20.15586054	1058.265
1_01_29_nir.jpg	-97.27143292	20.16006881	1033.425
1_02_30_nir.jpg	-97.26985259	20.16034492	1033.532
1_03_31_nir.jpg	-97.26827657	20.16064617	1032.934
1_04_32_nir.jpg	-97.26667318	20.16096077	1030.519
1_05_33_nir.jpg	-97.26509884	20.16124494	1029.813
1_06_34_nir.jpg	-97.26349861	20.16151471	1027.875
1_07_35_nir.jpg	-97.26194962	20.16177729	1024.293
1_08_36_nir.jpg	-97.26038078	20.16204487	1021.591
1_09_37_nir.jpg	-97.25878968	20.16231127	1019.147
1_10_38_nir.jpg	-97.25713024	20.16264419	1019.019
1_11_39_nir.jpg	-97.2555888	20.1629822	1022.23
1_12_40_nir.jpg	-97.25400601	20.16331565	1028.975
1_13_41_nir.jpg	-97.25241155	20.16362007	1031.193
1_14_42_nir.jpg	-97.25082216	20.16391703	1029.773
4_01_43_nir.jpg	-97.26158968	20.1653358	1026.504
4_02_44_nir.jpg	-97.2611893	20.16382023	1024.515
4_03_45_nir.jpg	-97.26082428	20.16231734	1025.158
4_04_46_nir.jpg	-97.26053104	20.16082946	1026.071
4_05_47_nir.jpg	-97.26020999	20.15930396	1027.525
4_06_48_nir.jpg	-97.2599087	20.15778896	1029.795
4_07_49_nir.jpg	-97.2596749	20.15632779	1034.163
4_08_50_nir.jpg	-97.25939464	20.15483963	1035.672
4_09_51_nir.jpg	-97.25908332	20.15340509	1037.295
4_10_52_nir.jpg	-97.25877959	20.15189465	1036.719
4_11_53_nir.jpg	-97.25849937	20.15042563	1032.958

I think you’re running an old version of the software that doesn’t have support for geo.txt. Try upgrading to the latest.

1 Like

Tnx @pierotofy

Upgraded with ./webodm.sh update and got

Pulling node-odm ... done
Pulling db       ... done
Pulling broker   ... done
Pulling worker   ... done
Pulling webapp   ... done
Done! You can now start WebODM by running ./webodm.sh start

This is the updated version I got

Still getting same error:

[INFO]    Found 7 usable images
[WARNING] GPS position not available for 4_05_47_nir.jpg
[WARNING] GPS position not available for 4_07_49_nir.jpg
[WARNING] GPS position not available for 4_08_50_nir.jpg
[WARNING] GPS position not available for 4_10_52_nir.jpg
[WARNING] GPS position not available for 4_11_53_nir.jpg
[WARNING] GPS position not available for 4_06_48_nir.jpg
[WARNING] GPS position not available for 4_09_51_nir.jpg

Again I am uploading the geo.txt along with the images.

What am I missing?

Tnx

Could you post the full log?

1 Like

Are you positive that the file names are 100% matched? Case is important here, I believe.

Hi @Saijin_Naib,

I think I have it right. I upload a few photos and the geo.txt I used to the link below. Its not enough imgs for an orthophoto but if you can look just to see that the geo.txt does allow for geotag of images in webODM it would be great.

The way I did it was to select it along with the images I wanted to use, i.e if I had 50 imgs I actually selected 51 files together with the geo.txt. That didn’t work. I also tried to select only the 50 imgs and leave the geo.txt in the same folder hoping it would be recognized automatically but that didnt work either.

Tnx much in advance !

https://drive.google.com/drive/folders/1PCabNln9U6hDpt1L__sfApteaa1k1MHO?usp=sharing

1 Like