我使用V3 js API实现了谷歌地图。我在地图内绘制了大约500个邮政编码多边形。邮政编码多边形的着色取决于某些工作正常的条件。就像我为一组zipcodes分配不同的颜色。但问题是当我在地图上放大一些zipcode多边形颜色getc改变。我们如何解决它。
这是代码
{% ifequal zip.rank 1 %}
var fillColor = '#FF0000';
{% endifequal %}
{% ifequal zip.rank 2 %}
var fillColor = '#FF00D3';
{% endifequal %}
{% ifequal zip.rank 3 %}
var fillColor = '#BE4BAA';
{% endifequal %}
{% ifequal zip.rank 4 %}
var fillColor = '#BE88B5';
{% endifequal %}
{% ifequal zip.rank 5 %}
var fillColor = '#857081';
{% endifequal %}
var path = [
{% for polycoord in zip.zip_info.zip_polygon %}
new google.maps.LatLng({{polycoord.1}}, {{polycoord.0}}),
{% endfor %}
];
var polygon = new google.maps.Polygon(
{
path:path,
clickable:true,
strokeColor: '#000000',
strokeOpacity: 0.75,
strokeWeight: 1,
fillColor: fillColor,
fillOpacity: 1,
}
);
polygon.setMap(map);