Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: ArchaeoloGIS on March 24, 2017, 07:58:59 PM

Title: Loading gcp coordinates from .txt or .csv in 1.3
Post by: ArchaeoloGIS on March 24, 2017, 07:58:59 PM
Is it possible in the current v.1.3 to load marker coordinates from a file using script and if yes how.
Sorry if the question is stupid but i am a newbie in programming and can't find out how to do it or if it's even possible with current version.
Title: Re: Loading gcp coordinates from .txt or .csv in 1.3
Post by: Alexey Pasumansky on March 24, 2017, 09:39:34 PM
Hello ArchaeolgoGIS,

You can do it using the same function that loads the coordinates for the cameras:

Code: [Select]
chunk = PhotoScan.app.document.chunk
path = "D:/markers.txt"
chunk.loadReference(path, format = PhotoScan.ReferenceFormatCSV, delimiter=",", columns="nxyz")

the same of the file for such function is the following:
Code: [Select]
point 1,123.321,124.432,543.1
Title: Re: Loading gcp coordinates from .txt or .csv in 1.3
Post by: ArchaeoloGIS on March 25, 2017, 12:35:56 PM
That is a fast reply. Thank you for the help.
So when i run the script i get some error -
2017-03-25 11:05:20 Traceback (most recent call last):
2017-03-25 11:05:20   File "H:/DAMJANICA_ALL/Damqnica_obekt_16_AM_STRUMA_LOT_33/PHOTOGRAMMETRY/script_for_loading_GCP.py", line 3, in <module>
2017-03-25 11:05:20     chunk.loadReference(path, format = PhotoScan.ReferenceFormatCSV, delimiter=";", columns="nxyz")
2017-03-25 11:05:20 OSError: Can't load reference: H:\DAMJANICA_ALL\Damqnica_obekt_16_AM_STRUMA_LOT_33\PHOTOGRAMMETRY\TERESTRIAL_CLOSE_RANGE_08_2016\SONDAJ_31_08_sondaj_31_GCP.csv
I have noticed that for some reason the path is changed and instead of 23 i have !!
The file path must be H:\DAMJANICA_ALL\Damqnica_obekt_16_AM_STRUMA_LOT_33\PHOTOGRAMMETRY\TERESTRIAL_CLOSE_RANGE\23_08_2016\SONDAJ_31\23_08_sondaj_31_GCP.csv
Tried to change the file name and dir and when i load the script and click ok nothing happens, if i load the file manually from import markers icon it works. We use coded target if it maters.
Title: Re: Loading gcp coordinates from .txt or .csv in 1.3
Post by: Alexey Pasumansky on March 25, 2017, 01:00:02 PM
Hello ArchaeoloGIS,

Can you change the "back slash" symbols in the path to the regular "slash"?