mapbox / tokml

Convert GeoJSON to KML.
http://mapbox.github.io/tokml/
BSD 2-Clause "Simplified" License
189 stars 91 forks source link

FeatureCollection Geojson leaflet Layergroup #35

Closed trentclinton closed 6 years ago

trentclinton commented 6 years ago

Hi,

I am new to this but I have been trying to convert a geojson object to kml... I have the string converted to a json object, but somehow, tokml never sees it...? But if the json obj I pass in is a single point or line, it works... here is a sample data

"{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-80.236331,25.917525],[-80.236329,25.917435]]}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-80.236329,25.917435],[-80.236327,25.917346]]}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-80.236327,25.917346],[-80.236324,25.917256]]}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-80.236324,25.917256],[-80.236322,25.917167]]}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-80.236322,25.917167],[-80.23632,25.917077]]}}]}"

Thank you in advance!!!

trentclinton commented 6 years ago

Fixed it... the leaflet function togeojson isn’t putting properties as one of its attribute. ToKml I guess is looking for that? I had to insert an empty property attribute to make tokml convert it to a kml. Thanks!