Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Bug with null values and opacity #296

Closed
talin-trulia opened this issue Sep 7, 2013 · 6 comments
Closed

Bug with null values and opacity #296

talin-trulia opened this issue Sep 7, 2013 · 6 comments
Labels
Milestone

Comments

@talin-trulia
Copy link

Here's an odd case I've come across in carto compiling.

This style

#the_layer{
  polygon-fill: grey;
  [data_column = null] { polygon-fill: red; polygon-opacity: 0.5; }
  [data_column >= 100] { polygon-fill: blue; }
}

results in the XML

<Style name="the_layer" filter-mode="first" >
  <Rule>
    <Filter>([data_column] = null)</Filter>
    <PolygonSymbolizer fill="#0000ff" fill-opacity="0.5" />
  </Rule>
  <Rule>
    <Filter>([data_column] &gt;= 100)</Filter>
    <PolygonSymbolizer fill="#0000ff" />
  </Rule>
  <Rule>
    <PolygonSymbolizer fill="#808080" />
  </Rule>
</Style>

which is incorrect. data=null is being rendered as blue, when it should be rendered as red.

The style without polygon opacity

#the_layer{
  polygon-fill: grey;
  [data_column = null] { polygon-fill: red; }
  [data_column >= 100] { polygon-fill: blue; } 
}

results in correct XML

<Style name="the_layer" filter-mode="first" >
  <Rule>
    <Filter>([data_column] &gt;= 100)</Filter>
    <PolygonSymbolizer fill="#0000ff" />
  </Rule>
  <Rule>
    <Filter>([data_column] = null)</Filter>
    <PolygonSymbolizer fill="#ff0000" />
  </Rule>
  <Rule>
    <PolygonSymbolizer fill="#808080" />
  </Rule>
</Style>

Also, the style with opacity specified on both

#the_layer{
  polygon-fill: grey;
  [data_column = null] { polygon-fill: red; polygon-opacity: 0.5; }
  [data_column >= 100] { polygon-fill: blue; polygon-opacity: 0.75; }
}

compiles as expected

<Style name="the_layer" filter-mode="first" >
  <Rule>
    <Filter>([data_column] &gt;= 100)</Filter>
    <PolygonSymbolizer fill="#0000ff" fill-opacity="0.75" />
  </Rule>
  <Rule>
    <Filter>([data_column] = null)</Filter>
    <PolygonSymbolizer fill="#ff0000" fill-opacity="0.5" />
  </Rule>
  <Rule>
    <PolygonSymbolizer fill="#808080" />
  </Rule>
</Style>

This bug only occurs with [data_column = null]. using [data_column = 0] produces the expected output, even with only one specified polygon-opacity

#the_layer{
  polygon-fill: grey;
  [data_column = 0] { polygon-fill: red; polygon-opacity: 0.5; }
  [data_column >= 100] { polygon-fill: blue; }
}
<Style name="the_layer" filter-mode="first" >
  <Rule>
    <Filter>([data_column] &gt;= 100)</Filter>
    <PolygonSymbolizer fill="#0000ff" fill-opacity="0.75" />
  </Rule>
  <Rule>
    <Filter>([data_column] = null)</Filter>
    <PolygonSymbolizer fill="#ff0000" fill-opacity="0.5" />
  </Rule>
  <Rule>
    <PolygonSymbolizer fill="#808080" />
  </Rule>
</Style>

note: all compilations were done with a stub project.mml, and the carto binary installed with tilemill, version 0.4.7

edit: tested on 0.9.4, issue still exhibits.

@springmeyer
Copy link

@tmcw - I plan to dig into this next week to parse apart what might be js behavior, vs carto behavior, vs mapnik behavior.

@kapouer
Copy link
Contributor

kapouer commented Sep 27, 2013

kapouer@721a6de, while not fixing every possible cases, shows where the problem is.

@springmeyer
Copy link

@kapouer - awesome, thanks for looking at this. As you can imagine, I've not found time to dig in yet.

@kapouer
Copy link
Contributor

kapouer commented Sep 27, 2013

i figured i could help carto 0.9.5 out :)

@springmeyer
Copy link

don't have time to fix before v0.9.5 tag, pushing to v0.9.6

@springmeyer
Copy link

perhaps related: c1e8c3b

@springmeyer springmeyer removed this from the 0.9.6 milestone Jul 9, 2015
@nebulon42 nebulon42 added the bug label Mar 2, 2016
@nebulon42 nebulon42 added this to the 0.17 milestone Dec 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants