By setting simplestyle: true in the options, tokml will automatically generate KML <Style> elements based on properties following the simplestyle-spec.
Supported Marker Styles
For Point or MultiPoint geometries, the following properties trigger marker styles:
marker-color: Hex color (e.g., #ff0000).marker-size: Size (e.g., small, medium, large).marker-symbol: Symbol name.
Note: Marker icons are served from Mapbox's API (e.g., https://api.tiles.mapbox.com/v3/marker/...).
Supported Line and Polygon Styles
For LineString, MultiLineString, Polygon, or MultiPolygon geometries, the following properties trigger styles:
stroke: Hex color for the line.stroke-opacity: Opacity (0.0 to 1.0).stroke-width: Width of the line.fill: Hex color for the polygon fill.fill-opacity: Opacity (0.0 to 1.0).
Example
const geojson = {
type: 'Feature',
geometry: { type: 'Point', coordinates: [0, 0] },
properties: {
'marker-color': '#ff0000',
'marker-size': 'large'
}
};
const kml = tokml(geojson, { simplestyle: true });