crs = PhotoScan.CoordinateSystem("EPSG::3948")
chunk.exportShapes(path, projection = crs)
Doesn't it work correctly on your projects?
# Export Orthophoto
path_ortho = path_export_chk + chunk.label + "_Ortho" + ".jpg"
chunk.exportOrthomosaic(path_ortho, format = "jpg",
raster_transform = PhotoScan.RasterTransformNone,
projection = PhotoScan.CoordinateSystem("EPSG::3948"),
write_world = True)
import os
import PhotoScan
print(""">>> Initialisation du script IV <<<""")
doc = PhotoScan.app.document
path_export = PhotoScan.app.getExistingDirectory("""Spécifiez le dossier
contenant les exports en fin de traitement""")
path_export += "\\"
print(""">>> Génération des fichiers de sortie <<<""")
for chunk in doc.chunks:
# Create a new folder
path_export_chk = path_export + "_SHP"
if not os.path.exists(path_export_chk):
os.makedirs(path_export_chk)
path_export_chk += "\\"
path_export_shp = path_export_chk + chunk.label
if not os.path.exists(path_export_shp):
os.makedirs(path_export_shp)
path_export_shp += "\\"
crs = PhotoScan.CoordinateSystem("EPSG::3948")
chunk.exportShapes(path_export_shp)
PhotoScan.app.update()
print(""">>> Fichiers exportés ! <<<""")
doc.save()
PhotoScan.app.update()
print(""">>> Script Partie IV terminé <<<""")
PhotoScan.Shapes.crs.transform(EPSG::4326, EPSG::3948)
PhotoScan.Shapes.crs.update
chunk = PhotoScan.app.document.chunk
shapes = chunk.shapes
source = shapes.crs
out = PhotoScan.CoordinateSystem("EPSG::3948")
for shape in chunk.shapes:
shape.vertices = [PhotoScan.CoordinateSystem.transform(v, source, out) for v in shape.vertices]
shapes.crs = out
import os, PhotoScan
doc = PhotoScan.app.document
chunk = doc.chunk
shapes = chunk.shapes
source = shapes.crs
out = PhotoScan.CoordinateSystem("EPSG::3948")
type_chunk = ['Green']
for chunk in doc.chunks:
if not any(type_chunk[0] in chunk.label for type_chunk in type_chunk):
for shape in chunk.shapes:
shape.vertices = [PhotoScan.CoordinateSystem.transform(v, source, out) for v in shape.vertices]
shapes.crs = out
print("""Les SHP de """ + chunk.label + """ ont été transformées avec succès !""")
for chunk in doc.chunks:
for shape in chunk.shapes:
if not any(type_chunk[0] in chunk.label for type_chunk in type_chunk):
chunk.exportShapes(path = "C:\\PFE_CAPRA\\Essais_Shapes\\Green.shp", groups = ShapeGroup(key = 1))
chunk.exportShapes(path = "C:\\PFE_CAPRA\\Essais_Shapes\\Approche.shp", groups = ShapeGroup(key = 2))
for layer in chunk.shapes.groups:
chunk.exportShapes(path, groups = layer)
Code: [Select]for layer in chunk.shapes.layers:
chunk.exportShapes(path, groups = layer)
import os, PhotoScan
doc = PhotoScan.app.document
chunk = doc.chunk
shapes = chunk.shapes
path = "C:\\PFE_CAPRA\\Essais_Shapes\\Shapes"
for chunk in doc.chunks:
for layer in chunk.shapes.groups:
chunk.exportShapes(path, groups = layer)
for chunk in doc.chunks:
Delete all layers but one based on layer labels
Export layer
Reopen project
Export next layer the same way
Loop through chunks
def getShapeLayer(chunk, label):
for layer in chunk.shapes.groups:
if layer.label == label:
return layer
print("Label not found")
return None