ibikecph / cphbikes

I Bike CPH Carto (old)
2 stars 3 forks source link

Add city and neighborhood labels #50

Closed sensescape closed 11 years ago

sensescape commented 11 years ago

neighborhood names and cities when zoomed out like this: http://www.ibikecph.dk

emiltin commented 11 years ago

and cities

sensescape commented 11 years ago

This is what I have currently for cities. Nothing is showing.

city-points-z9[zoom=9],

city-points-z10[zoom=10],

city-points-z11[zoom=11],

city-points-z12[zoom=12] {

text-name: '[name]';
text-face-name: 'Arial Regular';
text-fill: #fff;
text-halo-fill: @land;
text-placement: point;
text-max-char-angle-delta: 30;
text-wrap-width: 40;
text-halo-radius: 2;
text-allow-overlap: false;
text-size: 13;
text-spacing: 100;
text-line-spacing: -5;
text-wrap-width: 70;

}

city-points-z9[zoom=9] {

text-name: '[name]';
text-size: 13;

}

city-points-z9[zoom=9][font_size=20] {

text-name: '[name]';
text-size: 20;

}

city-points-z10[zoom=10] {

text-name: '[name]';
text-size: 13;

}

city-points-z10[zoom=10][font_size=20] {

text-name: '[name]';
text-size: 20;

}

city-points-z11[zoom=11] {

text-name: '[name]';
text-size: 13;

}

city-points-z11[zoom=11][font_size=20] {

text-name: '[name]';
text-size: 20;

}

city-points-z12[zoom=12] {

text-name: '[name]';
text-size: 13;

}

city-points-z12[zoom=12][font_size=20] {

text-name: '[name]';
text-size: 20;

}

sensescape commented 11 years ago

What do I use to get neighborhood names?

mojodna commented 11 years ago

I created a new layer (#place-labels), so you'll need to pull to get it. Once it's in, you can use this to fill in labels:

#place-labels
{
  [place='city'][zoom>=10],
  [place='town'][zoom>=10],
  [place='village'][zoom>=12],
  [place='suburb'][zoom>=13],
  [place='neighborhood'][zoom>=13],
  {
    text-name: '[name]';
    text-face-name: 'Arial Regular';
    text-fill: #fff;
    text-halo-fill: @land;
    text-placement: point;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: 2;
    text-allow-overlap: false;
    text-size: 13;
    text-spacing: 100;
    text-line-spacing: -5;
    text-wrap-width: 70;
  }
}
mojodna commented 11 years ago

(I think #city-points-* was generated by Dymo, which isn't really an option for this project because the data is going to be refreshed periodically by Emil etc. and we can't/shouldn't introduce additional [time-consuming] steps into the process.)

sensescape commented 11 years ago

Can we adjust font size according to population size for cities?

mojodna commented 11 years ago

Yes. Pull from GitHub to get an updated project file that exposes population and then add something like this (within the #place-labels block):

[population>=50000]
{
 text-size: 15;
}
sensescape commented 11 years ago

Tried this, but doesn't seem to have effect of the text size:

place-labels

{ [place='city'][zoom>=10], [place='town'][zoom>=10], [place='village'][zoom>=12], [place='suburb'][zoom>=13], [place='neighborhood'] { text-name: '[name]'; text-face-name: 'Arial Regular'; text-fill: #000; text-halo-fill: @land; text-max-char-angle-delta: 30; text-wrap-width: 40; text-halo-radius: 2; text-allow-overlap: false; text-size: 10; text-spacing: 100; text-line-spacing: 2; text-wrap-width: 70; }

[zoom>=11] { [population>=50000] { text-name: '[name]'; text-face-name: 'Arial Regular'; text-size: 20; } } }

mojodna commented 11 years ago

I'm guessing it's a CSS specificity thing. What happens if you comment out the block with the place types in it?

sensescape commented 11 years ago

Almost done. Just not sure if this is working or not: [zoom>=14][zoom<=15] { [population>=40000] { text-name: '[name]'; text-face-name: 'Arial Regular'; text-size: 17; }

[population>=15000]
{
  text-name: '[name]';
  text-face-name: 'Arial Regular';
  text-size: 14;
}

}

sensescape commented 11 years ago

done