This project has moved. For the latest updates, please go here.

Please help parse polygon from kml (VB NET)

Dec 29, 2014 at 5:03 PM
Hello.
Please help me: I need to parse longitude and latitude from kml file (polygon) ?
I am using Visual Basic Net 2013.

Thanks.
Regards,
Deniss
Coordinator
Dec 29, 2014 at 7:22 PM
What are you having problems with in particular?

There's a simple example in the documentation here which might help, though I don't have any examples in VB.NET the library should work just fine with it.

Sam
Dec 31, 2014 at 1:39 PM
Thank You Samcragg but in my case its doesn't working :(
I did try:
Dim Xml As String = IO.File.ReadAllText("c:\000\test.kml")
    Dim file As KmlFile
    Using stream = New MemoryStream(ASCIIEncoding.UTF8.GetBytes(Xml))
        file = KmlFile.Load(stream)
    End Using


    For Each poly In file.Root.Flatten().OfType(Of Polygon)()
        Console.WriteLine(poly.Id)
    Next

    Console.ReadKey()

Coordinator
Jan 2, 2015 at 10:52 PM
Is there any chance you can post a simple KML fragment that reproduces the error please\ and describe what the error is (i.e. is the error that it doesn't output anything or is an exception raised?)

Sam