Rowan,
Thanks for the reply - I've converted a couple of kmls to geojson formats and got leaflet reading them both in and colouring them differently.
This is much better than my old approach of reading in the kml file using php, splitting each element into an array and then picking out the coordinates into a javascript array for use in leaflet!
However, I have around 250 kml files and don't really want to convert each one - their traces of walks downloaded from runkeeper. Is it possible to read in the kml file, convert it to GeoJson and then disply it?
The ToGeoJson site on Github seems to suggest it is using toGeoJSON.kml(doc) but I don't understand how to get the kml file using JQuery - this bit in the text...
"Convert a KML document to GeoJSON. The first argument, doc, must be a KML document as an XML DOM - not as a string. You can get this using jQuery's default .ajax function or using a bare XMLHttpRequest with the .response property holding an XML DOM."
Would you (or anyone else) be able to offer assistance or point me in the right direction?
Thanks,
Matt