Open vincentsels opened 8 years ago
There's an open PR for this https://github.com/mapbox/tokml/pull/17
Sorry for the late response. Just looked into simplestyle-spec. I could indeed use that, by cloning the geoJson and dynamically enriching it with the desired simplestyle-spec properties, before passing it to tokml; thus avoiding the need for a 'style function' like I suggested.
The only thing that's lacking is a way to reference custom icons. I've read the reason it's not in the spec, but to be honest, I don't understand it with my limited knowledge about security. Why is it a problem that the image url might be non-ssl? Isn't it just up to the developer to make his site as secure (or not) as he deems necessary?
Oh, and another off-topic question: what's with the _
's as function parameter names? :)
Why is it a problem that the image url might be non-ssl?
Good reads for this are the pages on Mixed Content and Content Security Policy.
I am not able to add styles in KML file. I have added property as below
"stroke": "#064CA1", "stroke-opacity": 1, "stroke-width": 7.7,
but still not able to see polyline width or color, please suggest.
The resulting kml is without style, which isn't surprising - GeoJson doesn't inherently contain any style information either. However, Google Maps (and probably pretty much any maps library which supports GeoJson) has a way to give each feature a style, based on some properties. In the case of Google Maps, you can supply a single 'styling function', which is executed for every feature that's displayed on the map. Could we introduce a similar concept in this library? A styling function which accepts a feature and should return e.g. a json representation of the kml Style element? In its most basic form, this could generate inline style. Another option would be to work with style references, where a function determines which (static) style should be used for the specified feature, and then an map containing the definition of each of these (static) styles (still in json form). A combination of both would be ideal, so that a combination of both static as well as dynamic styles (depending on the feature's properties) is possible.
Any thoughts? If you agree, I'll be happy to give it a shot.