Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created December 18, 2012 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/4329932 to your computer and use it in GitHub Desktop.
Save tmcw/4329932 to your computer and use it in GitHub Desktop.
#world {
polygon-opacity:1;
[zoom=1][Z_ABBREV = 6] {
polygon-opacity:0.2;
}
[zoom=1][Z_NAME = 6] {
polygon-opacity:0.3;
}
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Style name="world" filter-mode="first" >
<Rule>
<MaxScaleDenominator>500000000</MaxScaleDenominator>
<MinScaleDenominator>200000000</MinScaleDenominator>
<Filter>([Z_NAME] = 6)</Filter>
<PolygonSymbolizer fill-opacity="0.3" />
</Rule>
<Rule>
<Filter>([Z_NAME] = 6)</Filter>
<PolygonSymbolizer fill-opacity="1" />
</Rule>
<Rule>
<MaxScaleDenominator>500000000</MaxScaleDenominator>
<MinScaleDenominator>200000000</MinScaleDenominator>
<Filter>([Z_ABBREV] = 6)</Filter>
<PolygonSymbolizer fill-opacity="0.2" />
</Rule>
<Rule>
<Filter>([Z_ABBREV] = 6)</Filter>
<PolygonSymbolizer fill-opacity="1" />
</Rule>
<Rule>
<PolygonSymbolizer fill-opacity="1" />
</Rule>
</Style>
<Layer name="world"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>world</StyleName>
<Datasource>
<Parameter name="file"><![CDATA[/Users/tmcw/src/carto/test/rendering/layers/world/931c441e-shape_demo.shp]]></Parameter>
<Parameter name="type"><![CDATA[shape]]></Parameter>
</Datasource>
</Layer>
</Map>
@tmcw
Copy link
Author

tmcw commented Dec 18, 2012

Research:

This only affects zoom filters in the 'three rules when there should be two' case.

@tmcw
Copy link
Author

tmcw commented Dec 18, 2012

Current candidate is https://github.com/mapbox/carto/blob/master/lib/carto/renderer.js#L178 either calling addRules incorrect or its implementation.

@tmcw
Copy link
Author

tmcw commented Dec 18, 2012

Definition.prototype.addRules just dumbly adds rules to a definition.

@tmcw
Copy link
Author

tmcw commented Dec 18, 2012

Line 63 of filterset.js is also part of the trap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment