This project has moved and is read-only. For the latest updates, please go here.

Different lat/lon delimiter when serializing

Apr 24, 2012 at 6:09 PM

I wonder if it's possible to change behavior of the serialization by replacing /r/n with a space? This is used after each lat/lon pair and somewhat inconvenient for me.

Apr 24, 2012 at 6:49 PM

The specification states that should be fine (emphesis mine):

[...] one or more coordinate tuples, with each tuple consisting of decimal values for geodetic longitude, geodetic latitude, and altitude. [...] The coordinate separator is a comma and the tuple separator is a whitespace.

I think the reason I used the newline was to match libkml output but the library will parse any whitespace. To use spaces you'll just need to change a couple of lines in CoordinateCollection.CreateStartElement in SharpKml/Dom/Fields/CoordinateCollection.cs - let me know if you get stuck.

Apr 24, 2012 at 7:24 PM
Edited Apr 24, 2012 at 7:25 PM

Thanks for the quick response. I definitely can change cs file but I downloaded just the binaries with hopes not to do anything with cs. Nonetheless that's an option I can use. Going forward you may just provide an optional parameter with \r\n default to the CoordinateCollection constructor to accept a different delimiter. It's probably a good idea to expose that delimiter as a public property as well. Also you may consider accepting a list of Vectors in the constructor and creating a public property for it because now the only option is to use Add method while I like property initializers :)

BTW,  excellent library! I stumbled a little with how to create a kml root and the document but other than that everything is very simple.

Aug 20, 2012 at 11:37 PM

1st.. GREAT LIB.. Thanks for doing this!

I also think having the option for the tuple delimiter would be good. As noted above, the library is following the KML spec by using the linefeed, unfortunately, I have a 3rd party tool that reads and render KML and it seems to like the tuples to be separated by a [space], and fails to interpret the line-feeds :(.

Aug 22, 2012 at 5:16 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.