Forum

Author Topic: ExportDEM as an XYZ file  (Read 3697 times)

dave.smith

  • Newbie
  • *
  • Posts: 5
    • View Profile
ExportDEM as an XYZ file
« on: December 11, 2017, 05:35:35 PM »
Quick questoin that's been driving me crazy all weekend. From the GUI (V1.3.0) it's possible to export an elevation model as an *.xyz file that defines the surface on a grid as a series of readable points. In local coordinates a typical file output would look like this:

-4.5657   3.0712   -21.344
-4.1664   3.0712   -21.330
-4.1093   3.0712   -21.330
-4.0523   3.0712   -21.330
-3.5389   3.0712   -21.373
-3.4818   3.0712   -21.373 etc etc


However I can't work out how (if it's supported) to setup the exportDEM() function to achieve the same result.

The closest I get is:

2017-12-11 13:28:19 Traceback (most recent call last):
2017-12-11 13:28:19   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/getDem_002.py", line 56, in <module>
2017-12-11 13:28:19     chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatXYZ, projection = chunk.crs, region = DEMregion, dx = DEMres, dy = DEMres)
2017-12-11 13:28:19 RuntimeError: Unsupported raster transform


From this code:

chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatTiles, projection = chunk.crs, region = DEMregion, dx = DEMres, dy = DEMres)

I've tried countless combinations of settings in chunk.exportDem(...)

Is this even possible or am i missing a trick?

Kind Regards

Dave


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #1 on: December 11, 2017, 06:17:45 PM »
Hello Dave,

Are you observing the same error in the version 1.3.4?

Also is the DEM generated using geographic projection method or was it Planar option (that you are using via GUI)?
Best regards,
Alexey Pasumansky,
Agisoft LLC

dave.smith

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #2 on: December 11, 2017, 07:49:30 PM »
Hi Alexey,

Firstly a correction on my behalf I'm using V 1.3.1 (Build 4030). I can't easily upgrade to 1.3.4 as I run photoscan pro on a remote system without root access.

A more detailed example of the code I'm running is:

if forceGeoRef: PhotoScan.app.document.chunk.transform.matrix = PhotoScan.app.document.chunk.transform.matrix

DEMFile = "%s/DEM.xyz" %resultsFolder
if exportDEM:
   DEMregion = (math.floor(chunk.elevation.left),math.floor(chunk.elevation.bottom),math.ceil(chunk.elevation.right),math.ceil(chunk.elevation.top))
   DEMres = math.ceil(100*chunk.elevation.resolution)/100.0
   chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatXYZ, projection = chunk.crs, region = DEMregion, dx = DEMres, dy = DEMres)


With various inputs I get the following errors:

RuntimeError: Unsupported raster transform
RuntimeError: Unsupported extension: .xyz
RuntimeError: Unsupported datum transformation

See consol dump below for more details...

I haven't checked rigorously but it doesn't seem to matter whther I've generated the DEM planer or geographic.

Any thoughts would be much appreciated...

Kind Regards

Dave


 16:30:18 Start photoscan working...
 16:30:18
 16:30:18 GETTING CHUNK
 16:30:18
 16:30:18 ExportRaster
 16:30:18 Finished processing in 9.5e-05 sec (exit code 0)
 16:30:18 Traceback (most recent call last):
 16:30:18   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/testing_002.py", line 56, in <module>
 16:30:18     chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatTiles, projection = chunk.crs, region = DEMregion, dx = DEMres, dy = DEMres)
 16:30:18 RuntimeError: Unsupported extension: .xyz
 16:31:20 Start photoscan working...
 16:31:20
 16:31:20 GETTING CHUNK
 16:31:20
 16:31:20 ExportRaster
 16:31:20 Exporting elevation model...
 16:31:21 Finished processing in 0.000194 sec (exit code 0)
 16:31:21 Traceback (most recent call last):
 16:31:21   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/testing_002.py", line 56, in <module>
 16:31:21     chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatXYZ, projection = chunk.crs, region = DEMregion, dx = DEMres, dy = DEMres)
 16:31:21 RuntimeError: Unsupported raster transform
 16:32:14 Start photoscan working...
 16:32:14
 16:32:14 GETTING CHUNK
 16:32:14
 16:32:14 ExportRaster
 16:32:14 Exporting elevation model...
 16:32:15 Finished processing in 0.009574 sec (exit code 0)
 16:32:15 Traceback (most recent call last):
 16:32:15   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/testing_002.py", line 57, in <module>
 16:32:15     chunk.exportDem(path=DEMFile, format=PhotoScan.RasterFormat.RasterFormatXYZ)
 16:32:15 RuntimeError: Unsupported datum transformation
 16:33:08 Start photoscan working...
 16:33:08
 16:33:08 GETTING CHUNK
 16:33:08
 16:33:08 ExportRaster
 16:33:08 Finished processing in 9.2e-05 sec (exit code 0)
 16:33:08 Traceback (most recent call last):
 16:33:08   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/testing_002.py", line 57, in <module>
 16:33:08     chunk.exportDem(path=DEMFile)
 16:33:08 RuntimeError: Unsupported extension: .xyz
 16:33:52 Start photoscan working...
 16:33:52
 16:33:52 GETTING CHUNK
 16:33:52
 16:33:52 ExportRaster
 16:33:52 Finished processing in 9.6e-05 sec (exit code 0)
 16:33:52 Traceback (most recent call last):
 16:33:52   File "/panfs/panasas01/ifac/jf13928/JOBS/171130_162506/settings/testing_002.py", line 57, in <module>
 16:33:52     chunk.exportDem(path=DEMFile)
 16:33:52 RuntimeError: Unsupported extension: .xyz
<--- checked for extension being case sensitive

dave.smith

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #3 on: December 11, 2017, 09:44:10 PM »
Quick update.

Our IT support have just updated me to 1.3.4 but I'm still experiencing the same behaviour

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #4 on: December 12, 2017, 12:13:44 AM »
Hello Dave,

Can you please try to use just export path in the exportDem() function? It seems that there's something wrong with the format usage, will check it shortly.
Best regards,
Alexey Pasumansky,
Agisoft LLC

dave.smith

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #5 on: December 12, 2017, 01:13:54 PM »
Good Morning Alexey,

I've tried specifying just the path as

Code: [Select]
DEMFile = "%s/DEM.xyz" %resultsFolder
chunk.exportDEM(path = DEMFile)

but I then get:

RuntimeError: Unsupported extension: .xyz

Any thoughts or workarounds?

Thankyou in advance

Dave

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #6 on: December 12, 2017, 05:15:59 PM »
Hello Dave,

I've checked DEM export in 1.3.4 and it worked in both cases:
chunk.exportDem(path = "D:/test.xyz")
and
chunk.exportDem(path = "D:/test2.xyz", format = PhotoScan.RasterFormatTiles)

So can you please check that you are running version 1.3.4 build 5067 indeed? Unsupported extension error for .xyz format has been observed in some older 1.3 versions. In the script body you can use print(PhotoScan.app.version) to output the version number to the console.

(note that RasterFormatXYZ is actually related to the Google Map Tiles, not to XYZ grid).
Best regards,
Alexey Pasumansky,
Agisoft LLC

dave.smith

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #7 on: December 12, 2017, 09:15:16 PM »
Sorted Alexey,

My/our mistake. When we upgraded to 1.3.4 it was linking to the old install or 1.3.1 and I never checked the version I was running was ACTUALLY 1.3.4.

As you said in 1.3.4 the xyz export performs as expected.

Thank you for your help

Kind Regards

Dave

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: ExportDEM as an XYZ file
« Reply #8 on: December 12, 2017, 10:06:12 PM »
Glad to hear that it's working properly now.
Best regards,
Alexey Pasumansky,
Agisoft LLC