DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Data Plugins for Exporting Files

Solved!
Go to solution

There is plenty of documentation on how to write and manipulate data plugins that read data into DIAdem.  I was hoping to find more information on how to set up DIAdem to export a file in different formats (when I save a file, I want to save as something different than TDM, TDMS, CSV).

Specifically I am looking to convert longitude, latitude and altitude channels into a KML file from DIAdem.

Any ideas?

0 Kudos
Message 1 of 3
(296 Views)
Solution
Accepted by topic author gsklyr
01-21-2019 11:32 AM

You might be able to write a KML file using a simple script.

The following script just writes a KML example file using the vbs XML writer.

 

It can be adapted to write KML files including data of the dataportal by extending the script.

Export plugins are only available as C++, which will potentially be more complicated.

 

Option Explicit

'<?xml version="1.0" encoding="UTF-8"?>
'<kml xmlns="http://www.opengis.net/kml/2.2">
'<Document>
'  <Placemark>
'    <name>Zürich</name>
'    <description>Zürich</description>
'    <Point>
'      <coordinates>8.55,47.3666667,0</coordinates>
'    </Point>
'  </Placemark>
'</Document>
'</kml>

dim dom : set dom = CreateObject("MSXML2.DOMDocument.3.0")
dom.loadXML("<?xml version=""1.0"" encoding=""UTF-8""?><kml xmlns=""http://www.opengis.net/kml/2.2""/>")
dim kmlE : set kmlE = dom.documentElement
dim DocumentE : set DocumentE = dom.createElement("Document") : kmlE.appendChild(DocumentE)
dim PlacemarkE : set PlacemarkE = dom.createElement("Placemark") : DocumentE.appendChild(PlacemarkE)
dim elem
set elem = dom.createElement("name") : PlacemarkE.appendChild elem : elem.appendChild dom.createTextNode("Zürich")
set elem = dom.createElement("description") : PlacemarkE.appendChild elem : elem.appendChild dom.createTextNode("Zürich")
dim PointE : set PointE = dom.createElement("Point") : PlacemarkE.appendChild(PointE)
dim coordinatesStr : coordinatesStr = ""
coordinatesStr = coordinatesStr & str(8.55)
coordinatesStr = coordinatesStr & "," & str(47.3666667)
coordinatesStr = coordinatesStr & "," & str(0)
set elem = dom.createElement("coordinates") : PointE.appendChild elem : elem.appendChild dom.createTextNode(coordinatesStr)

dom.save TmpDrv & "out.xml"
Message 2 of 3
(261 Views)

That's good! Thanks!

Can you point here to a starting point on how to write export plugins in C++ for future references (edit it into your answer maybe)?

0 Kudos
Message 3 of 3
(247 Views)