Closed yhahn closed 13 years ago
I dont think this used to take that long, but it definitely is a complex section. I can try to find a way to rework it, but the code you posted is not equivalent. What this style is doing is deciding at which zoom level certain types of labels should appear based on manually assigned values in the data table. (For example, smaller countries might have the abbreviated version of the label set to show for more zoom levels than other countries.)
Right, can you explain how these rules do what you described? It's opaque to me what the difference between the rules are.
For example, in the shapefile a particular country might have the following values:
This means I want the abbreviation label to be used at Z4 and above, until Z7 when it should switch to the common name label. The postal code and full administrative name won't be used, and the country won't have any label below Z4.
With your version the country would be labelled with the full name from Z2 and up.
With this logic, I'm basically defining a lot of unique styles with a basic set rules. This is necessary because there are a lot of zoom levels, a lot of different-sized countries, and a lot of different length labels that I'm trying to account for.
What I could do instead of handling this logic in Carto is preprocess the shapefile to flatten out the labelling logic there to a bunch of colums like label_z3
, label_z4
, label_z5
, etc.
Hmm, ok... can you explain how the current rules differ from
[zoom>=2][Z_POSTAL>=2][Z_POSTAL<=5] { text-name: "[POSTAL]"; }
[zoom>=2][Z_ABBREV>=2][Z_ABBREV<=6] { text-name: "[ABBREV]"; }
[zoom>=2][Z_NAME>=2][Z_NAME<=6] { text-name: "[NAME]"; }
[zoom>=2][Z_ADMIN>=2][Z_ADMIN<=6] { text-name: "[ADMIN]"; }
The Z_*
values don't match up to the proper zoom levels. [zoom>=2][Z_ADMIN>=2][Z_ADMIN<=6]
is true at zoom level 2 for a Z_ADMIN
value of 6
, but the intention is that if Z_ADMIN
is 6
, it should't show up below Z6.
o i see.
Such complex logic is overkill for an example project, so I removed it. The project still compiles very slowly for me. I'll see what else I can do..
This seems to have been resolved
I'm finding the carto compile time of
geography-class
to be extremely slow, around9000ms
and I've narrowed it down to these lineshttps://github.com/mapbox/tilemill/blob/master/examples/geography-class/labels.mss#L39-64
Replacing them with these lines drops compile time to
~200ms
but I'm not really sure what the reason was for the way the rules were defined originally.Would love to know the reason for the rules?