Hello

I am using the following code:

`# Get the coordinates from the user`

coord_x = app.getFloat("x coordinate:")

coord_y = app.getFloat("y coordinate:")

mySize = 9

# Define: Map region

# MapRegionVec = [CenterX, CenterY, SizeX0, SizeY0, ZRotationDeg]

MapRegionVec = [coord_x, coord_y, mySize, mySize, 0.0]

# Select the project

doc = PhotoScan.app.document

# Get the current chunk

chunk = doc.chunk

# Set Bounding Box

# create new region object

newregion = PhotoScan.Region()

# Set region center

centerUTM = PhotoScan.Vector([MapRegionVec[0], MapRegionVec[1], 0])

centerGEO = chunk.crs.unproject(centerUTM)

centerGEO.size = 4

centerGEO.w = 1

centerLocal = chunk.transform.matrix.inv() * centerGEO

newregion.center = PhotoScan.Vector([centerLocal[0], centerLocal[1], chunk.region.center[2]])

# Set region size

newregion.size = PhotoScan.Vector([MapRegionVec[2], MapRegionVec[3], chunk.region.size[2]])

# Set region rotation

# build rotation matrix in our coordinate system

RotZDeg = -MapRegionVec[4]

SinRotZ= math.sin(math.radians(RotZDeg))

CosRotZ= math.cos(math.radians(RotZDeg))

RotMat = PhotoScan.Matrix([[CosRotZ,-SinRotZ,0,0],[SinRotZ,CosRotZ,0,0],[0,0,1,0],[0,0,0,1]])

# Rotate region bounding box

T = chunk.transform.matrix

v = PhotoScan.Vector( [0,0,0,1] )

v_t = T * v

v_t.size = 3

m = chunk.crs.localframe(v_t)

m = m * T

m = RotMat*m

s = math.sqrt(m[0,0]**2 + m[0,1]**2 + m[0,2]**2) #scale factor

R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])

R = R * (1. / s)

newregion.rot = R.t()

# Put newregion to chunk

chunk.region = newregion

But I have 2 problems.

The first thing is that the size argument is wrong because if I enter 9.0 (as above) this is ca. 500 meters (But if I enter 500 in the size argument it's waaayyy to huge -> about 30km). How can I fix this?

And also the center coordinates that I'm entering are also not in the center of this. I'm using EPSG:21781 for my calculations. How can I really use them with center coordinates?

Or is it just the script that is wrong?