Feature suggestion: style function

Open
#27 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
data

Research direction

The issue names no files, tests, or entry points; begin by locating the GeoJSON-to-KML conversion entry point and its tests. Confirm the styling API and supported inline, static-reference, and mixed styles with maintainers; done means the agreed behavior is implemented and tested.

Written by the indexing model from the issue text.

Description

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.

Dominant language
JavaScript
Stars
193
Forks
91
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapbox/tokml

All issues in mapbox/tokml

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.