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

state name labels get rendered until z19 #1913

Closed
nebulon42 opened this issue Oct 14, 2015 · 3 comments · Fixed by #1914
Closed

state name labels get rendered until z19 #1913

nebulon42 opened this issue Oct 14, 2015 · 3 comments · Fixed by #1914

Comments

@nebulon42
Copy link
Contributor

Related to #1391.
Example: http://osm.org/go/0JrJIi_qT?m=

I think it does not make sense to render state name labels (admin_level=4) on high zoom levels, not even for the smaller states. Before #1134 we had cut-off zoom levels for admin name labels. We then moved to using way_pixels.

Currently admin_level=4 uses the same value as admin_level=2, namely 196000. I wanted to experiment with the value, but noted some strange behaviour. The label of the biggest Austrian state Lower Austria (https://www.openstreetmap.org/relation/77189, ~19.000 sq km, just for reference) disappeared at z8 when I used a value of 99999, but was rendered till z19 when I used a value of 100000.

To me this does not make sense. Can anybody explain this behaviour? Relevant code portions are https://github.com/gravitystorm/openstreetmap-carto/blob/master/placenames.mss#L21 and https://github.com/gravitystorm/openstreetmap-carto/blob/master/project.yaml#L1453.

@matthijsmelissen
Copy link
Collaborator

There are some weird bugs in Carto. Could it be related to any of the following?

mapbox/carto#315
mapbox/carto#351
mapbox/carto#369
mapbox/carto#370

@nebulon42
Copy link
Contributor Author

mapbox/carto#370 might be a good candidate. I had a look at the XML generated with carto 0.15.3.

<Style name="placenames-large" filter-mode="first">
  <Rule>
    <MaxScaleDenominator>6500000</MaxScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 99999)</Filter>
    <TextSymbolizer size="11" wrap-width="70" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>25000000</MaxScaleDenominator>
    <MinScaleDenominator>6500000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 99999)</Filter>
    <TextSymbolizer wrap-width="50" size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <MinScaleDenominator>25000000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 99999)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" wrap-width="0" placement="interior" ><![CDATA[[ref]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <MinScaleDenominator>25000000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 750) and ([way_pixels] &lt; 99999)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" wrap-width="0" placement="interior" ><![CDATA[[ref]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <Filter>([admin_level] = '2') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 196000)</Filter>
    <TextSymbolizer size="10" fill="#9d6c9d" fontset-name="fontset-1" halo-radius="1.5" wrap-width="50" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>200000000</MaxScaleDenominator>
    <MinScaleDenominator>50000000</MinScaleDenominator>
    <Filter>([admin_level] = '2') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 196000)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-1" halo-radius="1.5" wrap-width="50" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
</Style>
<Style name="placenames-large" filter-mode="first">
  <Rule>
    <MaxScaleDenominator>6500000</MaxScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 100000)</Filter>
    <TextSymbolizer size="11" wrap-width="70" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>25000000</MaxScaleDenominator>
    <MinScaleDenominator>6500000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 100000)</Filter>
    <TextSymbolizer wrap-width="50" size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <MinScaleDenominator>25000000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 100000)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" wrap-width="0" placement="interior" ><![CDATA[[ref]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>6500000</MaxScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000)</Filter>
    <TextSymbolizer size="11" wrap-width="70" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>25000000</MaxScaleDenominator>
    <MinScaleDenominator>6500000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000)</Filter>
    <TextSymbolizer wrap-width="50" size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <MinScaleDenominator>25000000</MinScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 750) and ([way_pixels] &lt; 100000)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" wrap-width="0" placement="interior" ><![CDATA[[ref]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>50000000</MaxScaleDenominator>
    <Filter>([admin_level] = '2') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 196000)</Filter>
    <TextSymbolizer size="10" fill="#9d6c9d" fontset-name="fontset-1" halo-radius="1.5" wrap-width="50" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
  <Rule>
    <MaxScaleDenominator>200000000</MaxScaleDenominator>
    <MinScaleDenominator>50000000</MinScaleDenominator>
    <Filter>([admin_level] = '2') and ([way_pixels] &gt; 3000) and ([way_pixels] &lt; 196000)</Filter>
    <TextSymbolizer size="9" fill="#9d6c9d" fontset-name="fontset-1" halo-radius="1.5" wrap-width="50" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>
</Style>

Interestingly, with 100000 there is a

<Rule>
    <MaxScaleDenominator>6500000</MaxScaleDenominator>
    <Filter>([admin_level] = '4') and ([way_pixels] &gt; 3000)</Filter>
    <TextSymbolizer size="11" wrap-width="70" fill="#9d6c9d" fontset-name="fontset-0" halo-radius="1.5" placement="interior" ><![CDATA[[name]]]></TextSymbolizer>
  </Rule>

rule without the upper limit that is not present with 99999. If I understand the XML correctly this should cause state name labels to be rendered from z7+ onwards if the way pixels are larger than 3000. This may cause the behaviour I noticed.

@nebulon42
Copy link
Contributor Author

Further testing reveals that if the first part of the following selector is omitted it works as expected:

    [zoom >= 4][zoom < 5][way_pixels > 750][way_pixels < 100000],
    [zoom >= 5][way_pixels > 3000][way_pixels < 100000] {

Could this be a fix? z4 is too crowded anyway and it might be good to not only remove state labels but also state borders from it. (Ah, forgot that this would be bad for e.g. the US.)

This change also does not trigger the bug:

    [zoom >= 4][zoom < 5][way_pixels > 750],
    [zoom >= 5][way_pixels > 3000] {
      [way_pixels < 500000] {

If way_pixels < 196000 is set above, the bug still occurs.

nebulon42 added a commit to nebulon42/openstreetmap-carto that referenced this issue Oct 15, 2015
nebulon42 added a commit to nebulon42/openstreetmap-carto that referenced this issue Oct 15, 2015
nebulon42 added a commit to nebulon42/openstreetmap-carto that referenced this issue Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants