Forum

Author Topic: Get bounding box coordinates in a specific system  (Read 1918 times)

Thibaud Capra

  • Full Member
  • ***
  • Posts: 101
  • Master Student in Geodetic Engineering & Surveying
    • View Profile
    • INSA de Strasbourg, Topography Engineering (French)
Get bounding box coordinates in a specific system
« on: February 21, 2017, 05:08:29 PM »
Hello everyone,
I'm trying to export the bounding box coordinates but I can't figure out a way of having them in one of the two following systems:

- RGF 93 / CC48 (EPSG::3948)
- WGS 84 (EPSG::4326)

For now I only have local coordinates...
Any help would be appreciated!

Current code:

Code: [Select]
# Determining bounding box size
import os
import PhotoScan
doc = PhotoScan.app.document
chunk = doc.addChunk()

path_export = PhotoScan.app.getExistingDirectory("""Spécifiez le dossier
 contenant les exports en fin de traitement""")
path_export += "\\"

box_list = list()
for chunk in doc.chunks:
    box_x = chunk.region.size.x
    box_y = chunk.region.size.y
    box_z = chunk.region.size.z
    box_list.append(chunk.label + " X=" + str(box_x) + " Y=" + str(box_y) + " Z=" + str(box_z))
print (box_list)

path_box = path_export + "Coordonnees_Bounding_Box.txt"
liste_boite = open(path_box, "w")
liste_boite.write(str(box_list))
liste_boite.close()

print(""">>> Coordonnées des boîtes englobantes exportées <<<""")

Result:
Code: [Select]
['Trou_18-Approche X=1.5205588006950554 Y=1.221272970580935 Z=4.5992786085513995', 'Trou_18-Green X=0.8813550129144896 Y=0.3206924763887408 Z=0.10798004251558357', 'Chunk 1 X=0.0 Y=0.0 Z=0.0', 'Chunk 2 X=0.0 Y=0.0 Z=0.0']
NB: I'm using PhotoScan Pro 1.2.6 build 2834 / Python API Release 1.2.0 seems to be working when using other scripts.

Best regards
« Last Edit: February 21, 2017, 05:19:27 PM by Thibaud Capra »
Best regards.
--
Thibaud CAPRA
Master Student in Geodetic Engineering, Cartography & Surveying
Master Thesis in Automated Processing of UAV-based Photogrammetric Data (ResearchGate Link)
INSA de Strasbourg, FRANCE
--