-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for reading arcinfo adf tin layers #162 #164
Conversation
@vcloarec nice.
But when I try to open it in QGIS, I get core dump. PS: we can probably use the attached TIN for test and credit http://lab.usgin.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good start. just few small notes, but in general it looks very good.
mdal/frmts/mdal_esri_tin.cpp
Outdated
#include "mdal_esri_tin.hpp" | ||
|
||
//from https://stackoverflow.com/questions/41012414/convert-double-value-from-little-endian-to-big-endian | ||
template <typename T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a function for this in https://github.com/lutraconsulting/MDAL/blob/master/mdal/frmts/mdal_selafin.cpp#L145
maybe we can just move that function to MDAL utils and use it here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added new function in MDAL utils, and I have changed selafin driver and esri tin driver.
Tell me what do you think about ?
But I am not sure that it is a good idea because the number of bytes read in the file depend now of the size of type. Is there a risk that this size of type is different from platform to other ? If yes, it is maybe not a good idea ...
mdal/frmts/mdal_esri_tin.cpp
Outdated
if ( ! faceIn.is_open() ) | ||
return false; | ||
|
||
//check if the file sizes of the nodes are coherent ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it does not need to be... what you can check is first line of some file if they have some standard header/first line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't more information that the position of the points and the indexes of the face. The unused first bytes (64 bytes for tnxy.adf, and 16 bytes for tnz.adf) are used by ArcGIS to store information about 4 virtual points created by ArcGIS for triangulation/generation (https://en.wikipedia.org/wiki/Esri_TIN, see Superpoint). Those points seem to be necessary for ArcGIS but not for MDAL.
So, for me, the only information to know if a file can be read is :
- if it can be opened
- if the size of the tns.adf file (Z value file) is coherent with the size of of tnxy.adf file.
I am not sure of the relevance of checking the size file coherence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep it as it is, just remove commented out code please
mdal/mdal_utils.cpp
Outdated
@@ -505,6 +506,12 @@ void MDAL::addBedElevationDatasetGroup( MDAL::Mesh *mesh, const Vertices &vertic | |||
mesh->datasetGroups.push_back( group ); | |||
} | |||
|
|||
void MDAL::addBedElevationDatasetGroup( MDAL::Mesh *mesh, const Vertices &vertices ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just use Bed elevation, not Terrain elevation . It is standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me "Bed Elevation" is specific for river bed elevation. Terrain Elevation could be more generic. As TIN are note only for river, that's why I purpose to keep Bed Elevation for format specific to hydraulic modeling, and maybe we can purpose another name for other format not specific to river.
A more generic name could be "Elevation" or simply "Altitude" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whatabout keeping the Bed elevation and just change the name in the TIN driver...?
Wow, great work.... That was super fast!! |
@saberraz |
@PeterPetrik , I try to look at all your comments may be later today. |
It is not the prettier TIN I've seen :) When it displayed on my screen, I believed there is a big issue in the code, but no... |
I've got some nice simple reference files incoming (freely licensed). Will post a link when I receive them! |
@nyalldawson |
I'll ask. Also trying to get some with tagged edges/vertices... |
Hello, Superpoints : Mask : Name of the TIN : Endianness : |
thanks a lot, merging! |
Awesome work -- this is very exciting! @PeterPetrik any chance of a mdal version bump prior to QGIS 3.10.0? |
Thanks @nyalldawson , I quickly tried to load the mesh in QGIS, and all have been loaded, with holes and islands. I will add this TIN to the test folder and add tests, but later, I don't have time anymore... |
For completeness, the attached updates to the tins adds an example with tagged vertices. That should cover all the functionality possible in this format: |
@nyalldawson @vcloarec any possibility you have time to add those to test suite? |
I don't have a lot of time this week for that. I will try next week. |
Hi, I think, during any of the conversions, faces have gone away and the vertices stay alone... Maybe, this is due of the border of the raster TIN. So, in the ESRI TIN files, it seems there are vertices without faces ... |
@vcloarec I can't work out quite where in the tin you are looking -- can you show the whole extent? |
@vcloarec disregard that, sorry! |
@vcloarec So those extra vertices are attached only to edges with a type of "Outside edge" (3). I gather you are currently stripping these away during the conversion? |
@nyalldawson, yes, outside faces (so implicitly associated edges, as MDAL doesn't store directly the edges) are stripped away. In any cases, even if there is no visual consequences to keep the isolated vertices, I think it is cleaner to strip away this vertices too when loading the mesh. |
First Draft, the mesh seems to be loaded. Need tests to verify if the geometry is ok.