Hello,
Providing that the input file has the information in the mentioned format (#camera_label #marker_label #px_x #px_y #world_x #world_y #altitude) you can use the following code for marker projection input automation:
#markers batch import script
#camera_label #marker_label #px_x #px_y #world_x #world_y #altitude
import PhotoScan
import os
doc = PhotoScan.app.document
chunk = doc.activeChunk
locations = chunk.ground_control.locations
path = "D:/input.txt"
file = open(path, "rt") #input file
eof = False
line = file.readline()
while not eof:
photos_total = len(chunk.cameras) #number of photos in chunk
markers_total = len(chunk.markers) #number of markers in chunk
line = file.readline() #reading the line in input file
sp_line = line.rsplit("\t", 6) #splitting read line by four parts
camera_name = sp_line[0] #camera label
marker_name = sp_line[1] #marker label
x = float(sp_line[2]) #x- coordinate of the current projection in pixels
y = float(sp_line[3]) #y- coordinate of the current projection in pixels
cx = float(sp_line[4]) #world x- coordinate of the current marker
cy = float(sp_line[5]) #world y- coordinate of the current marker
cz = float(sp_line[6]) #world z- coordinate of the current marker
flag = 0
for i in range (0, photos_total):
if chunk.cameras[i].label == camera.name:
for marker in chunk.markers: #searching for the marker (comparing with all the marker labels in chunk)
if marker.label == marker_name:
marker.projections[chunk.cameras[i]] = (x,y) #setting up marker projection of the correct photo)
flag = 1
break
if flag == 0:
chunk.markers.add()
marker = chunk.markers[-1]
marker.label = marker_name
marker.projections[chunk.photos[i]] = (x,y)
if marker not in locations.keys():
locations.add(marker)
locations[marker].coord = (cx, cy, cz)
break
line = file.readline() #reading the line in input file
if len(line) == 0:
eof = True
break # EOF
chunk.ground_control.apply()
file.close()
print("Import finished.") #information message
I hope it works, I've tried to adjust similar script quickly for your task.
Probably, you do not need to import coordinates for each marker multiple times, because the number of projections is usually about 5-10.