擅长:python、mysql、java
<p>如果我理解正确,您需要创建这样的函数(<code>x</code>是geojson):</p>
<pre class="lang-py prettyprint-override"><code>def my_style_function(x):
color = ''
if x['properties']['POP2005'] <= 10e6:
color = 'green'
elif x['properties']['POP2005'] < 2*10e6:
color = 'orange'
return {'fillColor': color if color else 'red'}
</code></pre>
<p>只需将其赋给<code>style_function</code>参数(不带括号):</p>
^{pr2}$