Forum

Author Topic: Loading Coordinates for markers  (Read 5207 times)

zoos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Loading Coordinates for markers
« on: January 11, 2017, 03:50:22 PM »
Hey I´m currently working on a python script which allows me to load Coordinates for markers.

Somehow i can't figure out why its not working.

This is my Code
Code: [Select]
import PhotoScan
import datetime
import glob
import os

doc = PhotoScan.app.document

chunk.crs = PhotoScan.CoordinateSystem('LOCAL_CS["Local CS",LOCAL_DATUM["Local Datum",0],UNIT["metre",1]]')
ppcoor = PhotoScan.app.getOpenFileName("Select Refence Data")

if ppcoor[-4:].lower() == ".csv":
refform = "csv"
else:
PhotoScan.app.messageBox("no .csv data selected")

redat=chunk.loadReference("ppcoor",format = refform, columns= "nxyz", delimiter=",")

chunk.updateTransform()

print(redat)

The output of the consolle is :  2017-01-11 13:34:28 False

I dont get why its falls ?

The imput file contend is:

target 1,1011.45,987.924,99.937
target 2,1025.332,989.054,100.036
target 3,1040.943,995.915,100.011
target 5,1045.459,1018.409,100.275

And the markers target 1-5 are already detected in my project.

Any thoughts ?

Cheers zoos






Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14839
    • View Profile
Re: Loading Coordinates for markers
« Reply #1 on: January 11, 2017, 04:08:12 PM »
Hello zoos,

If ppcoor is a path to the file, you should use it without quotes.

Best regards,
Alexey Pasumansky,
Agisoft LLC

zoos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Loading Coordinates for markers
« Reply #2 on: January 11, 2017, 04:25:19 PM »
damm i did not saw that.

thank you so much Alexey

now the Console returns: True

But the Coordinates still do not show up in the Reference Panel behind the markers.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14839
    • View Profile
Re: Loading Coordinates for markers
« Reply #3 on: January 11, 2017, 04:46:16 PM »
Hello zoos,

I don't see the definition of the chunk variable also, should be like chunk = doc.chunk.
Best regards,
Alexey Pasumansky,
Agisoft LLC

zoos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Loading Coordinates for markers
« Reply #4 on: January 11, 2017, 04:58:17 PM »
Hey Alexey

I just put it in ther. Thank you

I'm still relatively new to python programing.

The loadReference function is loading reference Coordinates from a csv file right ? But wish function do i have to use to tell photoscan that those coordinates are meant to reference Markers. So they show up in the reference pendel behind the markes. As if i would Import them over the GUI ?

zoos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Loading Coordinates for markers
« Reply #5 on: January 12, 2017, 01:45:58 PM »
Hey I just found my mistake.

chunk.markers[0]=chunk.loadReference(ppcoor,format = refform, columns= 'nxyz', delimiter=',')

that code works if you want to import markers with python.

Code: [Select]
import PhotoScan


doc = PhotoScan.app.document
chunk = doc.chunk

chunk.crs = PhotoScan.CoordinateSystem('LOCAL_CS["Local CS",LOCAL_DATUM["Local Datum",0],UNIT["metre",1]]')
ppcoor = PhotoScan.app.getOpenFileName("Select Refence Data")

if ppcoor[-4:].lower() == ".csv":
refform = "csv"
else:
PhotoScan.app.messageBox("no .csv data selected")

chunk.markers[0]=chunk.loadReference(ppcoor,format = refform, columns= 'nxyz', delimiter=',')

chunk.updateTransform()

« Last Edit: January 13, 2017, 12:30:51 PM by zoos »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14839
    • View Profile
Re: Loading Coordinates for markers
« Reply #6 on: January 12, 2017, 04:07:16 PM »
Hello zoos,

loadReference() function returns boolean value (true or false) so you do not need so assign chunk.markers[0] to this value.
Best regards,
Alexey Pasumansky,
Agisoft LLC