I need help for this question.
Want parse a kml file and maked from any Polyline a txt file.
I have a problem when want finde a name for separatly the polyline and convert my string whit all my latlon in a list.
step 1
read file, in <td> is my name (273, second polyline 274) for my filename
step 2
convert <coordinates> in a list and saved as txt-file
I dont finde a way to read the data <td> and <coordinates>
I need Text as Double for write any latlon in a list
in my compled kml file are 300 polyline to convert.
Want parse a kml file and maked from any Polyline a txt file.
I have a problem when want finde a name for separatly the polyline and convert my string whit all my latlon in a list.
step 1
read file, in <td> is my name (273, second polyline 274) for my filename
step 2
convert <coordinates> in a list and saved as txt-file
I dont finde a way to read the data <td> and <coordinates>
I need Text as Double for write any latlon in a list
in my compled kml file are 300 polyline to convert.
B4X:
Sub Globals
Dim TempName,TempAllCoords,TempCoords As String
Dim TempAllList,SafeList As List
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If parser.Parents.IndexOf("Document") > -1 Then
If Name="td" Then
TempName=Text.ToString
End If
If Name = "coordinates" Then
SafeList.Initialize
TempAllCoords=Text.ToString
TempCoords=TempAllCoords.Replace("0 ","")
Dim PolygonCoords1 () As Double=Array As Double(TempCoords) 'to convert string to double
Dim PolygonPoints1 As List=CoordsToLatLngList1(PolygonCoords1)
For i = 1 To PolygonPoints1.Size-1
Dim PointsTemp() As String = Regex.Split(",",PolygonPoints1.Get(i))
Dim ln As LatLng
ln.Initialize(PointsTemp(0),PointsTemp(1))
SafeList.Add(ln)
Next
Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirRootExternal & "/Grenzen",TempName&".txt",True))
Writer.WriteList(SafeList)
Writer.Close
End If
End If
End Sub
Sub CoordsToLatLngList1(PolygonCoords1() As Double) As List
Dim PolygonCoords1Count As Int=PolygonCoords1.Length
Dim LatLngList1 As List
LatLngList1.Initialize