Forum

Author Topic: Import GCP reference from csv  (Read 5030 times)

Braeden

  • Newbie
  • *
  • Posts: 17
    • View Profile
Import GCP reference from csv
« on: March 18, 2024, 11:01:05 AM »
Hi,

I am not having any luck getting python to import GCP's from a CSV

The code I am trying to acheive this with is:
Code: [Select]
       
chunk.importReference(gcp_csv,  format = Metashape.ReferenceFormatCSV, delimiter=",", columns="nxyz")

I have tried with and without format = Metashape.ReferenceFormatCSV (as I think this is the default format)

I get an output to terminal of:
ImportReference: path = D:/BK AGI/project name/GCP.csv, columns = nxyz, delimiter = ,


The CSV format is

IDstring,x,y,z


But when I open the project, no markers have been imported?

Any ideas?

Cheers


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15276
    • View Profile
Re: Import GCP reference from csv
« Reply #1 on: March 18, 2024, 11:37:03 AM »
Hello Braeden,

Can you please confirm, if you are able to import the coordinates of the markers from the same file via GUI using Import Reference button on the Reference pane toolbar?

Also please specify, if the markers with the labels corresponding to IDstring column values are already in the active chunk or should be created?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Braeden

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Import GCP reference from csv
« Reply #2 on: March 18, 2024, 05:46:26 PM »
Hi Alexey,

The csv can be imported via the gui, albeit with specifying a coord system on import. Haven't got to trying that with python yet.

The markers don't already exist, do they need to be created first with matching IDs, then have the reference coords imported / added to them?

Thanks for your help.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15276
    • View Profile
Re: Import GCP reference from csv
« Reply #3 on: March 18, 2024, 08:08:27 PM »
Hello Braeden,

I suggest to add the following two arguments to importReference command:
- create_markers = True
- items = [Metashape.ReferenceItemsMarkers]

Hope it solves the problem with automatic creation of the markers and loading reference for them.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Braeden

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Import GCP reference from csv
« Reply #4 on: March 19, 2024, 01:31:47 AM »
Hi,

Looks like it doesn't like the items argument?



    chunk.importReference(gcp_csv, delimiter=",", columns="nxyz", create_markers = True, items = [Metashape.ReferenceItemsMarkers])
ValueError: Invalid argument value: items




Edit: Removed the square brackets and it's importing now.

    chunk.importReference(gcp_csv, delimiter=",", columns="nxyz", create_markers = True, items = Metashape.ReferenceItemsMarkers)


Thanks for your help!
« Last Edit: March 19, 2024, 02:55:39 AM by Braeden »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15276
    • View Profile
Re: Import GCP reference from csv
« Reply #5 on: March 19, 2024, 06:04:55 PM »
Hello Braeden,

Sorry for confusion, but glad to hear that you have managed to fix the problem.
Best regards,
Alexey Pasumansky,
Agisoft LLC