Forum

Author Topic: Run GDAL in Agisoft Python script  (Read 4749 times)

MZPCS

  • Newbie
  • *
  • Posts: 5
    • View Profile
Run GDAL in Agisoft Python script
« on: November 15, 2013, 01:09:28 AM »
Hello,

I've written Python code that successfully automates an Agisoft workflow and runs in Agisoft and would like to add a step at the end using gdal_merge after Agisoft exports a blocked orthophoto.  Any tips on how to get GDAL functional from a script running within Agisoft?  Currently I can run gdal_merge from other places like OSGeo4W shell or a windows batch file that I created.  But it would be less steps for users to tack the merge at the end of the script in Agisoft.  Maybe this question is more about how to successfully install GDAL into Agisoft's Python environment.  Has anyone accomplished this?

Thanks!
Kevin
« Last Edit: November 15, 2013, 07:22:06 PM by MZPCS »

jedfrechette

  • Full Member
  • ***
  • Posts: 121
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
Re: Run GDAL in Agisoft Python script
« Reply #1 on: November 15, 2013, 11:48:58 PM »
You should be able to use Python's built-in subprocess module [1] to call gdal_merge as if you were running it from a standalone command line. I haven't tried it but I suspect you could also install GDAL's Python bindings within PhotoScans private Python installation so that you could use its API directly.

[1] http://docs.python.org/3.3/library/subprocess.html
Jed