Cave 3D DEM format

37 views
Skip to first unread message

vs.r...@gmail.com

unread,
Dec 11, 2022, 5:51:38 AM12/11/22
to TopoDroid
Hi Marco,

First of all I can't thank you enough for your colossal and extremely useful work.

I would like to ask for more precise indications on the exact format for DEM to correctly load a surface in Cave3D. I read carefully the specifications in the help and user manual and tried to specify correctly the crs. I either tried a .th file with the matrix and the coordinates and a .asc file with the matrix directly from QGIS. In both situations I got "Failed DEM loading". Another detail is I tried either with decimal degrees, dms and UTM coordinates (using the apropriate crs). These coordinates were entered manually for the surface station.

Surely I'm doing something wrong or missing a detail but with the manuals and help at hand I can't figure it out. On the other hand I'm able to generate .lox functional surface models with texture on the computer with Therion therefore I'm confident on the data. These same models I cannot open in TopoDroid nor load as a surface on Cave3D (it loads but below the buttons is pitch black). 

 I would be most grateful if you could give some clues. 

Additional information:
- TopoDroid v.6.0.78-29 (Tester)
- Therion v.6.13
- .th file structure:
surface
cs long-lat
grid-units m
grid 2.543471 42.317727 5 5 244 281
'matrix'
endsurface

- .asc file structure:
ncols    244                                                                                                                                      nrows    281                                                                                                                                    xllcorner    462377.5                                                                                                                       yllcorner    4685152.5                                                                                                                    cellsize    5                                                                                                                                         NODATA_value    -999  
'matrix'

Thank you. Best regards.

Marco Corvi

unread,
Dec 12, 2022, 5:54:26 AM12/12/22
to topo...@googlegroups.com
here is an example of asc.
i removed all data lines except the first two
and all but the first few data of the first two lines

--
You received this message because you are subscribed to the Google Groups "TopoDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topodroid+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topodroid/19363342-b885-4515-bf6d-ad3ba0e3f7ecn%40googlegroups.com.
LU-gb1.asc

Roger Verdaguer i Serrat

unread,
Dec 13, 2022, 5:23:53 PM12/13/22
to topo...@googlegroups.com
Thank you Marco, 

The file structure you send is the same as mine therefore. I made some amending on the file (tabs to spaces) and then it started to "Read DEM"  when I load (now it makes it even with all the files that caused "Failed DEM loading" previously). On the other hand when I click on the Terrain button TopoDroid crashes. All I know about informatics is very little (user level) and carved through effort to understand mainly Therion. Therefore I cannot support this report with more data about the crash. Certainly I run TopoDroid in a Blackview phone that has software maintenance issues (maybe the cause of the crash?) and random restart at will (the phone will of course).

If I can do something to help, make me know. 

Thank you for your support and patience. Best regards. 

Missatge de Marco Corvi <marco...@gmail.com> del dia dl., 12 de des. 2022 a les 11:54:

Seldor Sore

unread,
Oct 4, 2023, 1:48:05 PM10/4/23
to TopoDroid
Hi Marco
I'm struggling with the same. I even went so far to debug the java code to assert that my file is read correctly (once I found out, that the NODATA_value line is MANDATORY), but now I'm struggling to create one in the right CRS. I really can't find out at all, what CRS topodroid uses here..?
Even in your asc: "xllcorner 1588712 yllcorner 4842271" - where's that?
In my case it shows in the information page of Cave3D the following:
Origin: x 785026 y 5184046 z 2427
Coord: lon 10.2519570 lat 46.6343360

The coord's are clear and are correct - but in what CRS ist the origin (which I suppose would be the CRS I have to create the asc in)?? I wasn't even able to find it out using http://projfinder.com/ ....
Topodroid always reports that the DEM is invalid even if it is valid but doesn't cover the whole of the survey(s)... It would be nice to at least have a separate message for that because I spent hours to debug the format only to find out it is correct.

Thanks for a helping hand
Matt

Marco Corvi

unread,
Oct 4, 2023, 2:23:03 PM10/4/23
to topo...@googlegroups.com
the survey crs.

have you read the user manual ?

(there is a mistake: it says "model" instead of "reference system")

Screenshot_20231004-195325.png

Seldor Sore

unread,
Oct 4, 2023, 4:25:32 PM10/4/23
to TopoDroid
Yes, I've read that part a thousand time but it stil doesn't make sense to me.
First off, the only fixed point I have is entered in WGS84 (because that's the default and I did not use any conversion and wouldn't even understand how proj4 works at all because I cannot change the left nor right CRS there at all). However, those coordinates I posted are not WGS84 and nothing I recognize at all.
(And I don't understand what Therion or Loch have to do here anyway? This is Cave3D within Topodroid. Maybe that's based on Therion-Style data but I don't understand how 'therion' or 'loch' are involved here at all?)

So again - how do I find out what Topodroid uses as 'project CRS' here or how would I change it? If I could change it to EPSG:2056, I'd be more than happy but I seem to be too dumb to use proj4 (I cannot even change the two gray "LONG-LAT" buttons there to anything else). I've already selected Switzerland, but cannot change LONG-LAT to anything else. The description "To add a CRS you must give a nickname to the new CRS and write its spec in the proj4 syntax." is unfortunately very unhelpful - because it doesn't even say where I'd have to put the spec at all :-( . How do I add such a spec so that I could at least try to change the CRS to EPSG:2056?

Thanks Matt

Marco Corvi

unread,
Oct 5, 2023, 12:40:00 AM10/5/23
to topo...@googlegroups.com



On Wed, Oct 4, 2023, 10:25 PM Seldor Sore <matthias...@gmail.com> wrote:
Yes, I've read that part a thousand time but it stil doesn't make sense to me.
First off, the only fixed point I have is entered in WGS84 (because that's the default and I did not use any conversion and wouldn't even understand how proj4 works at all because I cannot change the left nor right CRS there at all). However, those coordinates I posted are not WGS84 and nothing I recognize at all.
(And I don't understand what Therion or Loch have to do here anyway? This is Cave3D within Topodroid. Maybe that's based on Therion-Style data but I don't understand how 'therion' or 'loch' are involved here at all?)

with geographical crs the 3d model is centered at the georeferenced station.
the coords are in m.
lat is computed from degrees along great circle.
long on the lat circle.
you can see the values in degrees in the georef dialog, and in m in the 3d window , selecting the station,

i dont remember if topodroid needs the coordinates of the dem ll corners in m, although it makes more sense that they are in (decimal) degrees.

So again - how do I find out what Topodroid uses as 'project CRS' here or how would I change it?

if the coordinates of the georeferenced point are not converted to a crs,
topodroid uses wgs84 coordinates.
otherwise it uses the converted crs.

using cartographic crs is easier.
all values are in m.

If I could change it to EPSG:2056, I'd be more than happy but I seem to be too dumb to use proj4 (I cannot even change the two gray "LONG-LAT" buttons there to anything else). I've already selected Switzerland, but cannot change LONG-LAT to anything else. The description "To add a CRS you must give a nickname to the new CRS and write its spec in the proj4 syntax." is unfortunately very unhelpful - because it doesn't even say where I'd have to put the spec at all :-( . How do I add such a spec so that I could at least try to change the CRS to EPSG:2056?

proj4:
open the app,
tap on one of the two crs button,
then "new crs"

proj4 specs for crs can be found on the web. for example on spatialreference

Marco Corvi

unread,
Oct 5, 2023, 7:40:51 AM10/5/23
to topo...@googlegroups.com
after checking the code:
the ll corner coordinates for WGS-84 must be in decimal degrees.
the (square) cell dimension must also be in decimal degrees. 

Seldor Sore

unread,
Oct 5, 2023, 12:45:12 PM10/5/23
to TopoDroid
Hi Marco
Ah finally I think that was the missing link.
I used QGIS to calculate the llcorner and cellsize in WGS84 and finally it loaded. So the successful header was the following using a DTM with 2m accuracy:

ncols        374
nrows        225
xllcorner    10.243770311000
yllcorner    46.631312268000
cellsize     0.000027049883
NODATA_value  0.00

Of course I would very much prefer to have the DTM in EPSG:2056 being a Cartesian 2D CS while trying to squeeze a rectangle into wgs84 always leads to inaccuracies. Given what you said and your example header it appears that it's possible to use other CRS.
But concerning proj4: I can long-click the button in the standalone proj4 app and add new CRS, but in the proj4 included in topodroid, this does not work (and I guess that's the only way I'd even be able to change the CRS, right?) So I guess this is a bug in Topodroid which at the moment does not allow me to change the CRS? I'm using TopoDroidX 6.2.18-33.

For reference, this is how the included tdmanager shows the coordinates (and that's how I entered them):
image.png
This is what the cave3d info page says:
image.png
I still don't really understand how to interpret those x 785026 y 5184046 exactly but if they could be changed to epsg:2056 that would be perfect
Thanks Matt

Marco Corvi

unread,
Oct 5, 2023, 2:11:08 PM10/5/23
to topo...@googlegroups.com
no.

when topodroid sends a request for proj4 the system starts proj4 the same way as standalone.
the only difference is that it is passed the request (a set of key-values).

the other difference is that when proj4  finishes it sends back the response (other key-values)

new-crs as well selection of the country works.


On Thu, Oct 5, 2023, 6:45 PM Seldor Sore <matthias...@gmail.com> wrote:
Hi Marco
Ah finally I think that was the missing link.
I used QGIS to calculate the llcorner and cellsize in WGS84 and finally it loaded. So the successful header was the following using a DTM with 2m accuracy:

ncols        374
nrows        225
xllcorner    10.243770311000
yllcorner    46.631312268000
cellsize     0.000027049883
NODATA_value  0.00

Of course I would very much prefer to have the DTM in EPSG:2056 being a Cartesian 2D CS while trying to squeeze a rectangle into wgs84 always leads to inaccuracies. Given what you said and your example header it appears that it's possible to use other CRS.
But concerning proj4: I can long-click the button in the standalone proj4 app and add new CRS, but in the proj4 included in topodroid, this does not work (and I guess that's the only way I'd even be able to change the CRS, right?) So I guess this is a bug in Topodroid which at the moment does not allow me to change the CRS? I'm using TopoDroidX 6.2.18-33.

topodroid has nothing to do with what proj4 does or does not.
when the request to convert is dispatched to proj4, topodroid is put in background and proj4 runs in foreground independently.
the two program send/receive request/response only to/from the system and these are just key-value sets.

For reference, this is how the included tdmanager shows the coordinates (and that's how I entered them):
image.png
This is what the cave3d info page says:
image.png
I still don't really understand how to interpret those x 785026 y 5184046

length of arc of circles in m

Seldor Sore

unread,
Oct 5, 2023, 4:03:02 PM10/5/23
to TopoDroid
Hi Marco
no.

when topodroid sends a request for proj4 the system starts proj4 the same way as standalone.
the only difference is that it is passed the request (a set of key-values).

the other difference is that when proj4  finishes it sends back the response (other key-values)

new-crs as well selection of the country works.

Well. no, it does not work.
I tried it on two different devices. When starting proj4 directly, everything works. When I start it form a survey > Survey Info > 'geo points symbol' > "+" > Proj4, the two buttons dont do anything at all. Neither a dropdown is shown nor the possibility to add something new on long-click. I can send you a video if you don't believe me, but it does not work.

Of course I would very much prefer to have the DTM in EPSG:2056 being a Cartesian 2D CS while trying to squeeze a rectangle into wgs84 always leads to inaccuracies. Given what you said and your example header it appears that it's possible to use other CRS.
But concerning proj4: I can long-click the button in the standalone proj4 app and add new CRS, but in the proj4 included in topodroid, this does not work (and I guess that's the only way I'd even be able to change the CRS, right?) So I guess this is a bug in Topodroid which at the moment does not allow me to change the CRS? I'm using TopoDroidX 6.2.18-33.

topodroid has nothing to do with what proj4 does or does not.
when the request to convert is dispatched to proj4, topodroid is put in background and proj4 runs in foreground independently.
the two program send/receive request/response only to/from the system and these are just key-value sets.

Well you said that the chosen CRS in proj4 affects the CRS used in the DTM, right?
So please tell me, am I right in assuming that the only way to get a EPSG:2056 DTM to work would be to enter the coordinates in EPSG:2056 using proj4? Or if not, please tell me how I could get an EPSG:2056 DTM to work? Your example posted earlier wasn't using WGS84 for llcorner, so it must be possible?



For reference, this is how the included tdmanager shows the coordinates (and that's how I entered them):
his is what the cave3d info page says:
I still don't really understand how to interpret those x 785026 y 5184046
length of arc of circles in m

Could you be a bit more specific? Does this mean, I'm 785km east of .. what exactly? Or what exactly do you mean with 'length of arc of circles' ?

Thanks and sorry for the many questions, I just want to understand what's happening and how I might be able to switch to EPSG:2056...

BTW, in proj4 there are a two errors in the Swiss CRS EPSG Numbers:
It lists the "21781 CH1903+ / LV95" which should instead be 2056 (not 21781) - the conversion and naming are correct but the EPSG number is wrong (21781 would be "CH1903 / LV03"
And the one named "21782 CH1903 / LV03" would in reality be EPSG 21781 according to its transformation.

Thanks
Matt

Marco Corvi

unread,
Oct 6, 2023, 12:40:59 AM10/6/23
to topo...@googlegroups.com


On Thu, Oct 5, 2023, 10:03 PM Seldor Sore <matthias...@gmail.com> wrote:
Hi Marco
no.

when topodroid sends a request for proj4 the system starts proj4 the same way as standalone.
the only difference is that it is passed the request (a set of key-values).

the other difference is that when proj4  finishes it sends back the response (other key-values)

new-crs as well selection of the country works.

Well. no, it does not work.
I tried it on two different devices. When starting proj4 directly, everything works. When I start it form a survey > Survey Info > 'geo points symbol' > "+" > Proj4, the two buttons dont do anything at all. Neither a dropdown is shown nor the possibility to add something new on long-click. I can send you a video if you don't believe me, but it does not work.

the crs of right button is fixed.
that on the left button can be chosen.

and new-crs works

Of course I would very much prefer to have the DTM in EPSG:2056 being a Cartesian 2D CS while trying to squeeze a rectangle into wgs84 always leads to inaccuracies. Given what you said and your example header it appears that it's possible to use other CRS.
But concerning proj4: I can long-click the button in the standalone proj4 app and add new CRS, but in the proj4 included in topodroid, this does not work (and I guess that's the only way I'd even be able to change the CRS, right?) So I guess this is a bug in Topodroid which at the moment does not allow me to change the CRS? I'm using TopoDroidX 6.2.18-33.

topodroid has nothing to do with what proj4 does or does not.
when the request to convert is dispatched to proj4, topodroid is put in background and proj4 runs in foreground independently.
the two program send/receive request/response only to/from the system and these are just key-value sets.

Well you said that the chosen CRS in proj4 affects the CRS used in the DTM, right?
So please tell me, am I right in assuming that the only way to get a EPSG:2056 DTM to work would be to enter the coordinates in EPSG:2056 using proj4? Or if not, please tell me how I could get an EPSG:2056 DTM to work? Your example posted earlier wasn't using WGS84 for llcorner, so it must be possible?

you can use proj4 to enter the coords in one system, but then you have to use it to convert the coords of the referenced point in the crs of the dtm.





For reference, this is how the included tdmanager shows the coordinates (and that's how I entered them):
his is what the cave3d info page says:
I still don't really understand how to interpret those x 785026 y 5184046

length of arc of circles in m

Could you be a bit more specific? Does this mean, I'm 785km east of .. what exactly? Or what exactly do you mean with 'length of arc of circles' ?

arc on meridian (roughly a circle, but not exactly) for lat from equator.
arc of lat circle for long from central meridian.

Thanks and sorry for the many questions, I just want to understand what's happening and how I might be able to switch to EPSG:2056...

BTW, in proj4 there are a two errors in the Swiss CRS EPSG Numbers:
It lists the "21781 CH1903+ / LV95" which should instead be 2056 (not 21781) - the conversion and naming are correct but the EPSG number is wrong (21781 would be "CH1903 / LV03"
And the one named "21782 CH1903 / LV03" would in reality be EPSG 21781 according to its transformation.

i got the name from spatialreference.
i will check again it.

Thanks
Matt

--
You received this message because you are subscribed to the Google Groups "TopoDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topodroid+...@googlegroups.com.
Screenshot_20231006-062735.png
Screenshot_20231006-062717.png

Roger Verdaguer i Serrat

unread,
Oct 20, 2023, 9:22:53 AM10/20/23
to topo...@googlegroups.com
Hi Marco and Matt,

Thanks for keep up with this issue because I let it down, shame on me. I couldn't figure out the issue with decimal degrees despite I was messing with it so thanks for the solution. On the other hand it still doesn't work for me because when I load the DEM surprisingly I'm dragged and dropped at Topodroid main menu. If I try again it crashes once for good and android let's me know it with a pop up. Could you be so kind to check my settings (following) only for if you can see something mistaken or maybe come up with something I'm not setting at all and I should? 

DTM file heading (for a 5m accuracy cell I calculated to decimal with a subtraction from two DD coordinates separed a kown value in m from UTM. Corners picked from QGIS):

ncols 244
nrows 281
xllcorner 42.32714321
yllcorner 2.551474281
cellsize 0.000000319884720045849000000
NODATA_value -999

 1225.117 1224.249...
  ...

Topo Droid various settings:
- Main -> 3D VIEWER -> DEM -> DEM buffer: 200
- Main -> 3D VIEWER -> DEM -> DEM max size: 400
- Main -> 3D VIEWER -> DEM -> DEM reduce: Subsample
- Main -> SURVEY DATA -> UNITS -> Angle units: decimal degrees
- Main -> SURVEY DATA -> LOCATION -> Coordinates units: decimal degrees
- Main -> SURVEY DATA -> LOCATION -> CRS: LONG-LAT
- Main -> SURVEY DATA -> LOCATION -> Neg. altitudes: Allow

Survey info and settings:
- Menu -> SURVEY INFO -> Geo-localized points: 0 42.327098 2.551474 1240
- Proj4: LONG-LAT to LONG-LAT


Does it make any sense for you? Do you think I'm missing something?

Thanks,
Roger. 

Libre de virus.www.avast.com

Missatge de Marco Corvi <marco...@gmail.com> del dia dv., 6 d’oct. 2023 a les 6:41:

Marco Corvi

unread,
Oct 20, 2023, 12:37:56 PM10/20/23
to topo...@googlegroups.com
DEM file might not be properly written.
I added some checks in the parser code, from v. 6.2.27.

Roger Verdaguer i Serrat

unread,
Oct 20, 2023, 1:14:25 PM10/20/23
to topo...@googlegroups.com
Sorry Marco, when you say properly written, you mean columns and rows, or point/comma issues for DEM file? I try to care about it but I will check it. 
Thanks.

Libre de virus.www.avast.com

Roger Verdaguer i Serrat

unread,
Oct 20, 2023, 1:15:59 PM10/20/23
to topo...@googlegroups.com
It works for Therion to make a functional Loch file though.

Libre de virus.www.avast.com

Missatge de Roger Verdaguer i Serrat <vs.r...@gmail.com> del dia dv., 20 d’oct. 2023 a les 19:14:

Marco Corvi

unread,
Oct 20, 2023, 1:19:06 PM10/20/23
to topo...@googlegroups.com
i mean that parsing should not cause the app crash.

--
You received this message because you are subscribed to the Google Groups "TopoDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topodroid+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages