Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow functions in array returned by style function #129

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document passing geometry type into style function
tomchadwin committed Nov 21, 2017
commit 71c7318724badb6a54abb7034486d6a231e07e9d
27 changes: 25 additions & 2 deletions docs/vectorgrid-api-docs.html
Original file line number Diff line number Diff line change
@@ -366,7 +366,7 @@ <h3 id='symbolizer-method'>Methods</h3>
<pre><code class="lang-js">var vectorTileOptions = {
vectorTileLayerStyles: {
// A plain set of L.Path options.
water: {
landuse: {
weight: 0,
fillColor: &#39;#9bc2c4&#39;,
fillOpacity: 1,
@@ -385,6 +385,29 @@ <h3 id='symbolizer-method'>Methods</h3>
fillOpacity: 0
}
},
// A function for styling features dynamically, depending on their
// properties, the map&#39;s zoom level, and the layer's geometry type
// (point, line, polygon)
water: function(properties, zoom, type) {
return [
{ // point
radius: 5,
color: &#39;#cf52d3&#39;,
},
{ // line
weight: 1,
color: &#39;#cf52d3&#39;,
dashArray: &#39;2, 6&#39;,
fillOpacity: 0
},
{ // polygon
weight: 1,
fillColor: &#39;#9bc2c4&#39;,
fillOpacity: 1,
fill: true
}
]
},
// An &#39;icon&#39; option means that a L.Icon will be used
place: {
icon: new L.Icon.Default()
@@ -399,7 +422,7 @@ <h3 id='symbolizer-method'>Methods</h3>
<li>A set of <code>L.Path</code> options</li>
<li>An array of sets of <code>L.Path</code> options</li>
<li>A function that returns a set of <code>L.Path</code> options</li>
<li>A function that returns an array of sets of <code>L.Path</code> options
<li>A function that returns an array of sets of <code>L.Path</code> options for point, line, and polygon styles respectively
<br>
Layers² with no style specified will use the default <code>L.Path</code> options.
<br>