add school labels

add school labels

/* due to the UNION of the point and line tables in the query
   we will get both nodes and ways */

/* perhaps carto isn't the best language here and we need a pre-processor that generates carto

ideally I would
*define a map for osm tags to sjjb icon file
*define a default lookuptable for zoom to icon size
*abstract away the full path
*/

/* accommodation */
#amenity[tourism='alpine_hut'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/alpine_hut.glow.000000.12.png');
}

#amenity[tourism='chalet'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/chalet.glow.000000.12.png');
}

#amenity[tourism='camp_site'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/camping.glow.000000.12.png');
}

#amenity[tourism='caravan_site'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/caravan_park.glow.000000.12.png');
}

#amenity[tourism='hotel'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/hotel.glow.000000.12.png');
}

#amenity[tourism='motel'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/motel.glow.000000.12.png');
}

/* amenity */
#amenity[amenity='bench'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/bench.glow.000000.12.png');
}

#amenity[amenity='courthouse'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/court.glow.000000.12.png');
}

#amenity[amenity='fire_station'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/firestation.glow.000000.12.png');
}

#amenity[amenity='foutain'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/fountain.glow.000000.12.png');
}

#amenity[amenity='library'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/library.glow.000000.12.png');
}

#amenity[amenity='playground'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/playground.glow.000000.12.png');
}

#amenity[amenity='police'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/police.glow.000000.12.png');
}

#amenity[amenity='post_box'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/post_box.glow.000000.12.png');
}

#amenity[amenity='post_office'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/post_office.glow.000000.12.png');
}

#amenity[amenity='prison'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/prison.glow.000000.12.png');
}

#amenity[amenity='public_building'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/public_building.glow.000000.12.png');
}

#amenity[amenity='recycling'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/recycling.glow.000000.12.png');
}

#amenity[man_made='survey_point'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/survey_point.glow.000000.12.png');
}

#amenity[amenity='telephone'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/telephone.glow.000000.12.png');
}

#amenity[amenity='toilets'] {
  [zoom>18] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.32.png');
  }
  [zoom>16][zoom<=18] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.20.png');
  }
  [zoom>12][zoom<=16] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.12.png');
  }
}

#amenity[amenity='townhall'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/town_hall.glow.000000.12.png');
}

#amenity[amenity='waste_basket'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/waste_bin.glow.000000.12.png');
}

#amenity[amenity='waste_disposal'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/waste_bin.glow.000000.12.png');
}

/* barrier */
#amenity[barrier='block'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/blocks.glow.000000.12.png');
}

#amenity[barrier='bollard'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/bollard.glow.000000.12.png');
}

#amenity[barrier='cattle_grid'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/cattle_grid.glow.000000.12.png');
}

#amenity[barrier='cycle_barrier'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/cycle_barrier.glow.000000.12.png');
}

#amenity[barrier='entrance'],#amenity[building='entrance'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/entrance.glow.000000.12.png');
}

#amenity[barrier='exit'],#amenity[building='exit'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/exit.glow.000000.12.png');
}

#amenity[barrier='gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/gate.glow.000000.12.png');
}

#amenity[barrier='kissing_gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/kissing_gate.glow.000000.12.png');
}

#amenity[barrier='lift_gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/lift_gate.glow.000000.12.png');
}

#amenity[barrier='steps'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/steps.glow.000000.12.png');
}

#amenity[barrier='stile'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/stile.glow.000000.12.png');
}

#amenity[barrier='toll_booth'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/toll_booth.glow.000000.12.png');
}

/* education */
#amenity[amenity='college'] {
  point-file: url('/usr/share/icons/sjjb/png/education/college.glow.000000.12.png');
}

#amenity[amenity='child_care'] {
  point-file: url('/usr/share/icons/sjjb/png/education/nursery.glow.000000.12.png');
}

#amenity[amenity='school'] {
  ::icon{
    point-file: url('/usr/share/icons/sjjb/png/education/school.glow.000000.12.png');
  }

  ::label{
    text-name: "[name]";
    text-face-name: "Liberation Sans Regular";
    text-fill: white;
    text-placement: point;
    text-halo-fill: #6c4600;
    text-halo-radius: 2.0;
    text-wrap-width: 20;
    text-vertical-alignment: bottom;
    text-opacity: 0.75;

    [zoom > 21] { text-size: 30; }
    [zoom = 21] { text-size: 25; }
    [zoom = 20] { text-size: 20; }
    [zoom = 19] { text-size: 15; }
    [zoom = 18] { text-size: 13; }
    [zoom = 17] { text-size: 12; }
    [zoom = 16] { text-size: 11; }
    [zoom = 15] { text-size: 11; }
    [zoom < 15] { text-size: 0; }
  }

  #amenity[amenity='school'][school_level='primary'] {
    point-file: url('/usr/share/icons/sjjb/png/education/school_primary.glow.000000.12.png');
  }

  #amenity[amenity='school'][school_level='secondary'] {
    point-file: url('/usr/share/icons/sjjb/png/education/school_secondary.glow.000000.12.png');
  }
}

#amenity[amenity='university'] {
  point-file: url('/usr/share/icons/sjjb/png/education/university.glow.000000.12.png');
}

/* health */

/* money */
#amenity[amenity='atm'] {
  point-file: url('/usr/share/icons/sjjb/png/money/atm.glow.000000.12.png');
}

#amenity[amenity='bank'] {
  point-file: url('/usr/share/icons/sjjb/png/money/bank.glow.000000.12.png');
}

/* sport */
[zoom > 16] {
  #sport[sport='archery'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/archery.glow.666666.12.png');
  }

  #sport[sport='baseball'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/baseball.glow.666666.12.png');
  }

  #sport[sport='canoe'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/canoe.glow.666666.12.png');
  }

  #sport[sport='cricket'],#sport[sport='cricket_nets'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/cricket.glow.666666.12.png');
  }

  #sport[sport='diving'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/diving.glow.666666.12.png');
  }

  #sport[sport='golf'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/golf.glow.666666.12.png');
  }

  #amenity[amenity='gym'],#amenity[leisure='gym'],#sport[sport='gym'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/gym.glow.666666.12.png');
  }

  #sport[sport='gymnasium'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/gymnasium.glow.666666.12.png');
  }

  #sport[sport='hillclimbing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/hillclimbing.glow.666666.12.png');
  }

  #sport[sport='horse_racing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/horse_racing.glow.666666.12.png');
  }

  #sport[sport='iceskating'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/iceskating.glow.666666.12.png');
  }

  #sport[sport='jetski'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/jetski.glow.666666.12.png');
  }

  #sport[sport='minature_golf'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/minature_golf.glow.666666.12.png');
  }

  #sport[sport='motorracing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/motorracing.glow.666666.12.png');
  }

  #amenity[leisure='playground'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/playground.glow.666666.12.png');
  }

  #sport[sport='sailing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/sailing.glow.666666.12.png');
  }

  #sport[sport='shooting'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/shooting.glow.666666.12.png');
  }

  #sport[sport='snooker'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/snooker.glow.666666.12.png');
  }

  #sport[sport='soccer'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/soccer.glow.666666.12.png');
  }

  /*stadium*/

  #sport[sport='swimming'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/swimming_indor.glow.666666.12.png');
  }

  #sport[sport='tennis'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/tennis.glow.666666.12.png');
  }

  #sport[sport='windsurfing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/windsurfing.glow.666666.12.png');
  }
}

/*
FIXME need to write a perl script to auto generate this file. I want the below
rules, but again for zoom>18 with a larger png symbol
*/

/* shops and food */
[zoom > 16] {
  #shop[shop='alcohol']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/alcohol.glow.DA0092.12.png');
  }

  #shop[shop='bakery']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/bakery.glow.DA0092.12.png');
  }

  #shop[shop='bicycle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/bicycle.glow.DA0092.12.png');
  }

  #shop[shop='book']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/book.glow.DA0092.12.png');
  }

  #shop[shop='butcher']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/butcher.glow.DA0092.12.png');
  }

  #shop[shop='car']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/car.glow.DA0092.12.png');
  }

  #shop[shop='car_repair']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/car_repair.glow.DA0092.12.png');
  }

  #shop[shop='clothes']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/clothes.glow.DA0092.12.png');
  }

  #shop[shop='computer']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/computer.glow.DA0092.12.png');
  }

  #shop[shop='confectionery']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/confectionery.glow.DA0092.12.png');
  }

  #shop[shop='convenience']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/convenience.glow.DA0092.12.png');
  }

  #shop[shop='copyshop']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/copyshop.glow.DA0092.12.png');
  }

  #shop[shop='department_store']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/department_store.glow.DA0092.12.png');
  }

  #shop[shop='diy']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/diy.glow.DA0092.12.png');
  }

  #shop[shop='estateagent']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/estateagent.glow.DA0092.12.png');
  }

  #shop[shop='fish']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/fish.glow.DA0092.12.png');
  }

  #shop[shop='florist']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/florist.glow.DA0092.12.png');
  }

  #shop[shop='garden_centre']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/garden_centre.glow.DA0092.12.png');
  }

  #shop[shop='gift']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/gift.glow.DA0092.12.png');
  }

  #shop[shop='greengrocer']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/greengrocer.glow.DA0092.12.png');
  }

  #shop[shop='hairdresser']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hairdresser.glow.DA0092.12.png');
  }

  #shop[shop='hearing_aids']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hearing_aids.glow.DA0092.12.png');
  }

  #shop[shop='hifi']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hifi.glow.DA0092.12.png');
  }

  #shop[shop='jewelry']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/jewelry.glow.DA0092.12.png');
  }

  #shop[shop='kiosk']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/kiosk.glow.DA0092.12.png');
  }

  #shop[shop='laundrette']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/laundrette.glow.DA0092.12.png');
  }

  #shop[shop='marketplace']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/marketplace.glow.DA0092.12.png');
  }

  #shop[shop='mobile_phone']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/mobile_phone.glow.DA0092.12.png');
  }

  #shop[shop='motorcycle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/motorcycle.glow.DA0092.12.png');
  }

  #shop[shop='music']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/music.glow.DA0092.12.png');
  }

  #shop[shop='newspaper']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/newspaper.glow.DA0092.12.png');
  }

  #shop[shop='pet']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/pet.glow.DA0092.12.png');
  }

  #shop[shop='photo']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/photo.glow.DA0092.12.png');
  }

  #shop[shop='supermarket']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/supermarket.glow.DA0092.12.png');
  }

  #shop[shop='tackle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/tackle.glow.DA0092.12.png');
  }

  #shop[shop='tobacco']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/tobacco.glow.DA0092.12.png');
  }

  #shop[shop='toys']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/toys.glow.DA0092.12.png');
  }

  #shop[shop='vending_machine']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/vending_machine.glow.DA0092.12.png');
  }

  #shop[shop='video_rental']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/video_rental.glow.DA0092.12.png');
  }

  #shop[amenity='bar']{
    point-file: url('/usr/share/icons/sjjb/png/food/bar.glow.DA0092.12.png');
  }

  #shop[amenity='biergarten']{
    point-file: url('/usr/share/icons/sjjb/png/food/biergarten.glow.DA0092.12.png');
  }

  #shop[amenity='cafe']{
    point-file: url('/usr/share/icons/sjjb/png/food/cafe.glow.DA0092.12.png');
  }

  #shop[amenity='drinking_water'],#shop[amenity='tap']{
    point-file: url('/usr/share/icons/sjjb/png/food/drinkingtap.glow.DA0092.12.png');
  }

  #shop[amenity='fastfood']{
    point-file: url('/usr/share/icons/sjjb/png/food/fastfood.glow.DA0092.12.png');

    #shop[cuisine='pizza']{
      point-file: url('/usr/share/icons/sjjb/png/food/fastfood_pizza.glow.DA0092.12.png');
    }
  }

  #shop[shop='ice_cream']{
    point-file: url('/usr/share/icons/sjjb/png/food/ice_cream.glow.DA0092.12.png');
  }

  #shop[shop='pizza']{
    point-file: url('/usr/share/icons/sjjb/png/food/pizza.glow.DA0092.12.png');
  }

  #shop[amenity='pub']{
    point-file: url('/usr/share/icons/sjjb/png/food/pub.glow.DA0092.12.png');
  }

  #shop[amenity='restaurant']{
    point-file: url('/usr/share/icons/sjjb/png/food/restaurant.glow.DA0092.12.png');
  }
}

/*
select count(amenity) as c, amenity from planet_osm_point group by amenity order by c desc limit 100;

2594 | parking
 1917 | fuel
 1523 | toilets
 1015 | post_box
  968 | place_of_worship
  911 | pub
  858 | telephone
  820 | bench
  744 | school
  732 | fast_food
  610 | cafe
  541 | restaurant
  384 | post_office
  346 | police
  327 | bank
  320 | fire_station
  298 | bbq
  294 | drinking_water
  241 | shelter
  229 | pharmacy
  190 | bicycle_parking
  175 | waste_basket
  163 | atm
  142 | hospital
  130 | emergency_phone
  104 | library
  100 | bus_station
   92 | public_building
   85 | ferry_terminal
   84 | doctors
   62 | cinema
   58 | taxi
   58 | kindergarten
   54 | playground
   51 | bar
   43 | theatre
   42 | licensed_club
   41 | courthouse
   36 | townhall
   34 | car_wash
   33 | picnic_table
   32 | college
   28 | bts
   25 | shower
   22 | veterinary
   20 | arts_centre
   20 | fountain
   19 | recycling
   16 | grave_yard
   15 | university
   15 | dentist
   12 | winery
   11 | swimming_pool
   11 | club
   10 | picnic table
    9 | waste_disposal
    9 | embassy
    9 | preschool
    9 | community_centre
    8 | fire_hydrant
    7 | vet
    7 | child_care
*/

/* due to the UNION of the point and line tables in the query
   we will get both nodes and ways */

/* perhaps carto isn't the best language here and we need a pre-processor that generates carto

ideally I would
*define a map for osm tags to sjjb icon file
*define a default lookuptable for zoom to icon size
*abstract away the full path
*/

/* accommodation */
#amenity[tourism='alpine_hut'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/alpine_hut.glow.000000.12.png');
}

#amenity[tourism='chalet'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/chalet.glow.000000.12.png');
}

#amenity[tourism='camp_site'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/camping.glow.000000.12.png');
}

#amenity[tourism='caravan_site'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/caravan_park.glow.000000.12.png');
}

#amenity[tourism='hotel'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/hotel.glow.000000.12.png');
}

#amenity[tourism='motel'] {
  point-file: url('/usr/share/icons/sjjb/png/accommodation/motel.glow.000000.12.png');
}

/* amenity */
#amenity[amenity='bench'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/bench.glow.000000.12.png');
}

#amenity[amenity='courthouse'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/court.glow.000000.12.png');
}

#amenity[amenity='fire_station'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/firestation.glow.000000.12.png');
}

#amenity[amenity='foutain'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/fountain.glow.000000.12.png');
}

#amenity[amenity='library'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/library.glow.000000.12.png');
}

#amenity[amenity='playground'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/playground.glow.000000.12.png');
}

#amenity[amenity='police'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/police.glow.000000.12.png');
}

#amenity[amenity='post_box'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/post_box.glow.000000.12.png');
}

#amenity[amenity='post_office'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/post_office.glow.000000.12.png');
}

#amenity[amenity='prison'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/prison.glow.000000.12.png');
}

#amenity[amenity='public_building'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/public_building.glow.000000.12.png');
}

#amenity[amenity='recycling'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/recycling.glow.000000.12.png');
}

#amenity[man_made='survey_point'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/survey_point.glow.000000.12.png');
}

#amenity[amenity='telephone'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/telephone.glow.000000.12.png');
}

#amenity[amenity='toilets'] {
  [zoom>18] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.32.png');
  }
  [zoom>16][zoom<=18] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.20.png');
  }
  [zoom>12][zoom<=16] {
    point-file: url('/usr/share/icons/sjjb/png/amenity/toilets.glow.000000.12.png');
  }
}

#amenity[amenity='townhall'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/town_hall.glow.000000.12.png');
}

#amenity[amenity='waste_basket'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/waste_bin.glow.000000.12.png');
}

#amenity[amenity='waste_disposal'] {
  point-file: url('/usr/share/icons/sjjb/png/amenity/waste_bin.glow.000000.12.png');
}

/* barrier */
#amenity[barrier='block'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/blocks.glow.000000.12.png');
}

#amenity[barrier='bollard'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/bollard.glow.000000.12.png');
}

#amenity[barrier='cattle_grid'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/cattle_grid.glow.000000.12.png');
}

#amenity[barrier='cycle_barrier'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/cycle_barrier.glow.000000.12.png');
}

#amenity[barrier='entrance'],#amenity[building='entrance'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/entrance.glow.000000.12.png');
}

#amenity[barrier='exit'],#amenity[building='exit'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/exit.glow.000000.12.png');
}

#amenity[barrier='gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/gate.glow.000000.12.png');
}

#amenity[barrier='kissing_gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/kissing_gate.glow.000000.12.png');
}

#amenity[barrier='lift_gate'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/lift_gate.glow.000000.12.png');
}

#amenity[barrier='steps'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/steps.glow.000000.12.png');
}

#amenity[barrier='stile'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/stile.glow.000000.12.png');
}

#amenity[barrier='toll_booth'] {
  point-file: url('/usr/share/icons/sjjb/png/barrier/toll_booth.glow.000000.12.png');
}

/* education */
#amenity[amenity='college'] {
  point-file: url('/usr/share/icons/sjjb/png/education/college.glow.000000.12.png');
}

#amenity[amenity='child_care'] {
  point-file: url('/usr/share/icons/sjjb/png/education/nursery.glow.000000.12.png');
}

#amenity[amenity='school'] {
  point-file: url('/usr/share/icons/sjjb/png/education/school.glow.000000.12.png');

  text-name: "[name]";
  text-face-name: "Liberation Sans Regular";
  text-fill: white;
  text-placement: point;
  text-halo-fill: #ffc863;
  text-halo-radius: 1.0;
  text-wrap-width: 20;
  text-vertical-alignment: bottom;

  #amenity[amenity='school'][school_level='primary'] {
    point-file: url('/usr/share/icons/sjjb/png/education/school_primary.glow.000000.12.png');
  }

  #amenity[amenity='school'][school_level='secondary'] {
    point-file: url('/usr/share/icons/sjjb/png/education/school_secondary.glow.000000.12.png');
  }
}

#amenity[amenity='university'] {
  point-file: url('/usr/share/icons/sjjb/png/education/university.glow.000000.12.png');
}

/* health */

/* money */
#amenity[amenity='atm'] {
  point-file: url('/usr/share/icons/sjjb/png/money/atm.glow.000000.12.png');
}

#amenity[amenity='bank'] {
  point-file: url('/usr/share/icons/sjjb/png/money/bank.glow.000000.12.png');
}

/* sport */
[zoom > 16] {
  #sport[sport='archery'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/archery.glow.666666.12.png');
  }

  #sport[sport='baseball'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/baseball.glow.666666.12.png');
  }

  #sport[sport='canoe'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/canoe.glow.666666.12.png');
  }

  #sport[sport='cricket'],#sport[sport='cricket_nets'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/cricket.glow.666666.12.png');
  }

  #sport[sport='diving'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/diving.glow.666666.12.png');
  }

  #sport[sport='golf'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/golf.glow.666666.12.png');
  }

  #amenity[amenity='gym'],#amenity[leisure='gym'],#sport[sport='gym'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/gym.glow.666666.12.png');
  }

  #sport[sport='gymnasium'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/gymnasium.glow.666666.12.png');
  }

  #sport[sport='hillclimbing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/hillclimbing.glow.666666.12.png');
  }

  #sport[sport='horse_racing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/horse_racing.glow.666666.12.png');
  }

  #sport[sport='iceskating'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/iceskating.glow.666666.12.png');
  }

  #sport[sport='jetski'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/jetski.glow.666666.12.png');
  }

  #sport[sport='minature_golf'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/minature_golf.glow.666666.12.png');
  }

  #sport[sport='motorracing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/motorracing.glow.666666.12.png');
  }

  #amenity[leisure='playground'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/playground.glow.666666.12.png');
  }

  #sport[sport='sailing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/sailing.glow.666666.12.png');
  }

  #sport[sport='shooting'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/shooting.glow.666666.12.png');
  }

  #sport[sport='snooker'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/snooker.glow.666666.12.png');
  }

  #sport[sport='soccer'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/soccer.glow.666666.12.png');
  }

  /*stadium*/

  #sport[sport='swimming'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/swimming_indor.glow.666666.12.png');
  }

  #sport[sport='tennis'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/tennis.glow.666666.12.png');
  }

  #sport[sport='windsurfing'] {
    point-file: url('/usr/share/icons/sjjb/png/sport/windsurfing.glow.666666.12.png');
  }
}

/* shops and food */
[zoom > 16] {
  #shop[shop='alcohol']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/alcohol.glow.DA0092.12.png');
  }

  #shop[shop='bakery']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/bakery.glow.DA0092.12.png');
  }

  #shop[shop='bicycle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/bicycle.glow.DA0092.12.png');
  }

  #shop[shop='book']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/book.glow.DA0092.12.png');
  }

  #shop[shop='butcher']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/butcher.glow.DA0092.12.png');
  }

  #shop[shop='car']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/car.glow.DA0092.12.png');
  }

  #shop[shop='car_repair']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/car_repair.glow.DA0092.12.png');
  }

  #shop[shop='clothes']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/clothes.glow.DA0092.12.png');
  }

  #shop[shop='computer']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/computer.glow.DA0092.12.png');
  }

  #shop[shop='confectionery']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/confectionery.glow.DA0092.12.png');
  }

  #shop[shop='convenience']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/convenience.glow.DA0092.12.png');
  }

  #shop[shop='copyshop']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/copyshop.glow.DA0092.12.png');
  }

  #shop[shop='department_store']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/department_store.glow.DA0092.12.png');
  }

  #shop[shop='diy']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/diy.glow.DA0092.12.png');
  }

  #shop[shop='estateagent']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/estateagent.glow.DA0092.12.png');
  }

  #shop[shop='fish']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/fish.glow.DA0092.12.png');
  }

  #shop[shop='florist']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/florist.glow.DA0092.12.png');
  }

  #shop[shop='garden_centre']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/garden_centre.glow.DA0092.12.png');
  }

  #shop[shop='gift']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/gift.glow.DA0092.12.png');
  }

  #shop[shop='greengrocer']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/greengrocer.glow.DA0092.12.png');
  }

  #shop[shop='hairdresser']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hairdresser.glow.DA0092.12.png');
  }

  #shop[shop='hearing_aids']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hearing_aids.glow.DA0092.12.png');
  }

  #shop[shop='hifi']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/hifi.glow.DA0092.12.png');
  }

  #shop[shop='jewelry']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/jewelry.glow.DA0092.12.png');
  }

  #shop[shop='kiosk']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/kiosk.glow.DA0092.12.png');
  }

  #shop[shop='laundrette']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/laundrette.glow.DA0092.12.png');
  }

  #shop[shop='marketplace']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/marketplace.glow.DA0092.12.png');
  }

  #shop[shop='mobile_phone']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/mobile_phone.glow.DA0092.12.png');
  }

  #shop[shop='motorcycle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/motorcycle.glow.DA0092.12.png');
  }

  #shop[shop='music']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/music.glow.DA0092.12.png');
  }

  #shop[shop='newspaper']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/newspaper.glow.DA0092.12.png');
  }

  #shop[shop='pet']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/pet.glow.DA0092.12.png');
  }

  #shop[shop='photo']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/photo.glow.DA0092.12.png');
  }

  #shop[shop='supermarket']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/supermarket.glow.DA0092.12.png');
  }

  #shop[shop='tackle']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/tackle.glow.DA0092.12.png');
  }

  #shop[shop='tobacco']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/tobacco.glow.DA0092.12.png');
  }

  #shop[shop='toys']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/toys.glow.DA0092.12.png');
  }

  #shop[shop='vending_machine']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/vending_machine.glow.DA0092.12.png');
  }

  #shop[shop='video_rental']{
    point-file: url('/usr/share/icons/sjjb/png/shopping/video_rental.glow.DA0092.12.png');
  }

  #shop[amenity='bar']{
    point-file: url('/usr/share/icons/sjjb/png/food/bar.glow.DA0092.12.png');
  }

  #shop[amenity='biergarten']{
    point-file: url('/usr/share/icons/sjjb/png/food/biergarten.glow.DA0092.12.png');
  }

  #shop[amenity='cafe']{
    point-file: url('/usr/share/icons/sjjb/png/food/cafe.glow.DA0092.12.png');
  }

  #shop[amenity='drinking_water'],#shop[amenity='tap']{
    point-file: url('/usr/share/icons/sjjb/png/food/drinkingtap.glow.DA0092.12.png');
  }

  #shop[amenity='fastfood']{
    point-file: url('/usr/share/icons/sjjb/png/food/fastfood.glow.DA0092.12.png');

    #shop[cuisine='pizza']{
      point-file: url('/usr/share/icons/sjjb/png/food/fastfood_pizza.glow.DA0092.12.png');
    }
  }

  #shop[shop='ice_cream']{
    point-file: url('/usr/share/icons/sjjb/png/food/ice_cream.glow.DA0092.12.png');
  }

  #shop[shop='pizza']{
    point-file: url('/usr/share/icons/sjjb/png/food/pizza.glow.DA0092.12.png');
  }

  #shop[amenity='pub']{
    point-file: url('/usr/share/icons/sjjb/png/food/pub.glow.DA0092.12.png');
  }

  #shop[amenity='restaurant']{
    point-file: url('/usr/share/icons/sjjb/png/food/restaurant.glow.DA0092.12.png');
  }
}

/*
select count(amenity) as c, amenity from planet_osm_point group by amenity order by c desc limit 100;

2594 | parking
 1917 | fuel
 1523 | toilets
 1015 | post_box
  968 | place_of_worship
  911 | pub
  858 | telephone
  820 | bench
  744 | school
  732 | fast_food
  610 | cafe
  541 | restaurant
  384 | post_office
  346 | police
  327 | bank
  320 | fire_station
  298 | bbq
  294 | drinking_water
  241 | shelter
  229 | pharmacy
  190 | bicycle_parking
  175 | waste_basket
  163 | atm
  142 | hospital
  130 | emergency_phone
  104 | library
  100 | bus_station
   92 | public_building
   85 | ferry_terminal
   84 | doctors
   62 | cinema
   58 | taxi
   58 | kindergarten
   54 | playground
   51 | bar
   43 | theatre
   42 | licensed_club
   41 | courthouse
   36 | townhall
   34 | car_wash
   33 | picnic_table
   32 | college
   28 | bts
   25 | shower
   22 | veterinary
   20 | arts_centre
   20 | fountain
   19 | recycling
   16 | grave_yard
   15 | university
   15 | dentist
   12 | winery
   11 | swimming_pool
   11 | club
   10 | picnic table
    9 | waste_disposal
    9 | embassy
    9 | preschool
    9 | community_centre
    8 | fire_hydrant
    7 | vet
    7 | child_care
*/


Fixed: Bar objects on staff 0

Fixed: Bar objects on staff 0

This commit ensures that bar objects assigned to voice 0 are assigned to voice 1.

function MSplitString (string, delimiter) {
    //$module(Utilities.mss)
    /*
        The default Splitstring method is buggy,
        so I've re-implemented it here.

        Delimiter is optional; if it is false, this will
        split the string into an array of characters.
    */
    ret = CreateSparseArray();
    pos = 0;
    // If there is no delimiter, split the string
    // into an array of characters.
    if (delimiter = false)
    {
        for i = 0 to Length(string)
        {
            ret.Push(Substring(string, i, 1));
        }
        return ret;
    }

    for i = 0 to Length(string) + 1
    {
        if (utils.CharAt(string, i) = delimiter)
        {
            ret.Push(Substring(string, pos, i - pos));
            pos = i + 1;
        }

        if (i = Length(string))
        {
            ret.Push(Substring(string, pos, Length(string) - pos));
        }
    }
    return ret;
}  //$end

function PrevPow2 (val) {
    //$module(Utilities.mss)
    if (val = 0)
    {
        return 0;
    }
    //val = val - 1;
    val = utils.bwOR(val, utils.shr(val, 1));
    val = utils.bwOR(val, utils.shr(val, 2));
    val = utils.bwOR(val, utils.shr(val, 4));
    val = utils.bwOR(val, utils.shr(val, 8));
    val = utils.bwOR(val, utils.shr(val, 16));
    // this might be a hack, but I wrote it in
    // a power outage with no internet.
    // we get the next power of two, and then
    // divide by two to get the previous one.
    val = (val + 1) / 2;
    return val;
}  //$end

function SimpleNoteHash (nobj) {
    //$module(Utilities.mss)
    /*
        Generate a simple note hash. Not guaranteed to be unique given
        any suitably large sample of notes, but should be unique enough for quick
        checks.
    */
    pos = nobj.ParentNoteRest.Position;
    pitch = nobj.Pitch;
    duration = nobj.Duration;
    voice = nobj.VoiceNumber;
    name = nobj.Name;
    parent_bar_number = nobj.ParentNoteRest.ParentBar.BarNumber;
    parent_staff_number = nobj.ParentNoteRest.ParentBar.ParentStaff.StaffNum;
    time = nobj.ParentNoteRest.Time;

    hash = '' & pos & '-' & pitch & '-' & duration & '-' & voice & '-' & name & '-' & parent_bar_number & '-' & parent_staff_number & '-' & time;

    return hash;

}  //$end

function GetNoteObjectAtPosition (bobj) {
    //$module(Utilities.mss)
    // takes a dictionary of {pos:id} mappings for a given
    // voice, and returns the NoteRest object. If one isn't found
    // exactly at `position`, it will first look back (previous)
    // and then look forward, for candidate objects.

    objectPositions = Self._property:ObjectPositions;
    staff_num = bobj.ParentBar.ParentStaff.StaffNum;
    bar_num = bobj.ParentBar.BarNumber;
    voice_num = bobj.VoiceNumber;

    staffObjectPositions = objectPositions[staff_num];
    barObjectPositions = staffObjectPositions[bar_num];
    voiceObjectPositions = barObjectPositions[voice_num];

    if (voiceObjectPositions = null)
    {
        // theres not much we can do here. Bail.
        return null;
    }

    if (voiceObjectPositions.PropertyExists(bobj.Position))
    {
        obj_id = voiceObjectPositions[bobj.Position];
        obj = libmei.getElementById(obj_id);
        return obj;
    }
    else
    {
        // if we can't find anything at this position,
        // find the previous and subsequent objects, and align the
        // lyrics with them.
        prev_obj = bobj.PreviousItem(voice_num, 'NoteRest');

        if (prev_obj != null)
        {
            // there should be an object registered here
            obj_id = voiceObjectPositions[prev_obj.Position];
            obj = libmei.getElementById(obj_id);
            return obj;
        }
        else
        {
            next_obj = bobj.NextItem(voice_num, 'NoteRest');

            if (next_obj != null)
            {
                obj_id = voiceObjectPositions[next_obj.Position];
                obj = libmei.getElementById(obj_id);
                return obj;
            }
        }
    }

    return null;
}  //$end

function AddBarObjectInfoToElement (bobj, element) {
    //$module(Utilities.mss)
    /*
        adds timing and position info (startids, endids, tstamps, etc.) to an element
        This info is mostly derived from the base BarObject class.
    */
    voicenum = bobj.VoiceNumber;
    bar = bobj.ParentBar;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice/layer 0.
        voicenum = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar.BarNumber, voicenum, 'Bar object'));
    }

    if (bobj.Type = 'Line')
    {
        // lines have durations, but symbols do not.
        if (bobj.Duration > 0)
        {
            libmei.AddAttribute(element, 'dur.ges', bobj.Duration & 'p');
        }
    }

    libmei.AddAttribute(element, 'tstamp', ConvertPositionToTimestamp(bobj.Position, bobj.ParentBar));

    if (bobj.Type = 'Line' or bobj.Type = 'Slur')
    {
        libmei.AddAttribute(element, 'tstamp2', ConvertPositionToTimestamp(bobj.EndPosition, bar));
    }

    libmei.AddAttribute(element, 'staff', bar.ParentStaff.StaffNum);

    libmei.AddAttribute(element, 'layer', voicenum);

    if (bobj.Dx > 0)
    {
        libmei.AddAttribute(element, 'ho', ConvertOffsetsToMillimeters(bobj.Dx));
    }

    if (bobj.Dy > 0)
    {
        libmei.AddAttribute(element, 'vo', ConvertOffsetsToMillimeters(bobj.Dy));
    }

    return element;

}  //$end

function TupletsEqual (t, t2) {
    //$module(Utilities.mss)

    // shamelessly copied from the built-in tuplet plugin.
    tIsBar = (t = null) or (t.Type = 'Bar');
    t2IsBar = (t2 = null) or (t2.Type = 'Bar');

    if( tIsBar and t2IsBar ) { return true; }
    if( tIsBar or t2IsBar ) { return false; }

    b = t.ParentBar;
    b2 = t2.ParentBar;

    if( b.BarNumber != b2.BarNumber ) { return false; }
    if( b.ParentStaff.StaffNum != b2.ParentStaff.StaffNum ) { return 0; }
    if( t.VoiceNumber != t2.VoiceNumber ) { return false; }

    if( t.Position != t2.Position ) { return false; }
    if( t.PlayedDuration != t2.PlayedDuration ) { return false; }

    return true;

}  //$end

function IsLastNoteInTuplet (bobj) {
    //$module(Utilities.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return false;
    }

    tuplet = bobj.ParentTupletIfAny;

    if (bobj.PositionInTuplet >= tuplet.Duration)
    {
        return true;
    }

    return false;

}  //$end

function lstrip (str) {
    //$module(Utilities.mss)
    if (utils.CharAt(str, 0) = ' ')
    {
        return Substring(str, 1);
    }
    else
    {
        return str;
    }
}  //$end

function rstrip (str) {
    //$module(Utilities.mss)
    if (utils.CharAt(str, Length(str) - 1) = ' ')
    {
        return Substring(str, 0, Length(str) - 1);
    }
    else
    {
        return str;
    }
}  //$end

function Log (message) {
    //$module(Utilities.mss)
    Sibelius.AppendLineToFile(LOGFILE, message, True);
}  //$end

function MSplitString (string, delimiter) {
    //$module(Utilities.mss)
    /*
        The default Splitstring method is buggy,
        so I've re-implemented it here.

        Delimiter is optional; if it is false, this will
        split the string into an array of characters.
    */
    ret = CreateSparseArray();
    pos = 0;
    // If there is no delimiter, split the string
    // into an array of characters.
    if (delimiter = false)
    {
        for i = 0 to Length(string)
        {
            ret.Push(Substring(string, i, 1));
        }
        return ret;
    }

    for i = 0 to Length(string) + 1
    {
        if (utils.CharAt(string, i) = delimiter)
        {
            ret.Push(Substring(string, pos, i - pos));
            pos = i + 1;
        }

        if (i = Length(string))
        {
            ret.Push(Substring(string, pos, Length(string) - pos));
        }
    }
    return ret;
}  //$end

function PrevPow2 (val) {
    //$module(Utilities.mss)
    if (val = 0)
    {
        return 0;
    }
    //val = val - 1;
    val = utils.bwOR(val, utils.shr(val, 1));
    val = utils.bwOR(val, utils.shr(val, 2));
    val = utils.bwOR(val, utils.shr(val, 4));
    val = utils.bwOR(val, utils.shr(val, 8));
    val = utils.bwOR(val, utils.shr(val, 16));
    // this might be a hack, but I wrote it in
    // a power outage with no internet.
    // we get the next power of two, and then
    // divide by two to get the previous one.
    val = (val + 1) / 2;
    return val;
}  //$end

function SimpleNoteHash (nobj) {
    //$module(Utilities.mss)
    /*
        Generate a simple note hash. Not guaranteed to be unique given
        any suitably large sample of notes, but should be unique enough for quick
        checks.
    */
    pos = nobj.ParentNoteRest.Position;
    pitch = nobj.Pitch;
    duration = nobj.Duration;
    voice = nobj.VoiceNumber;
    name = nobj.Name;
    parent_bar_number = nobj.ParentNoteRest.ParentBar.BarNumber;
    parent_staff_number = nobj.ParentNoteRest.ParentBar.ParentStaff.StaffNum;
    time = nobj.ParentNoteRest.Time;

    hash = '' & pos & '-' & pitch & '-' & duration & '-' & voice & '-' & name & '-' & parent_bar_number & '-' & parent_staff_number & '-' & time;

    return hash;

}  //$end

function GetNoteObjectAtPosition (bobj) {
    //$module(Utilities.mss)
    // takes a dictionary of {pos:id} mappings for a given
    // voice, and returns the NoteRest object. If one isn't found
    // exactly at `position`, it will first look back (previous)
    // and then look forward, for candidate objects.

    objectPositions = Self._property:ObjectPositions;
    staff_num = bobj.ParentBar.ParentStaff.StaffNum;
    bar_num = bobj.ParentBar.BarNumber;
    voice_num = bobj.VoiceNumber;

    staffObjectPositions = objectPositions[staff_num];
    barObjectPositions = staffObjectPositions[bar_num];
    voiceObjectPositions = barObjectPositions[voice_num];

    if (voiceObjectPositions = null)
    {
        // theres not much we can do here. Bail.
        return null;
    }

    if (voiceObjectPositions.PropertyExists(bobj.Position))
    {
        obj_id = voiceObjectPositions[bobj.Position];
        obj = libmei.getElementById(obj_id);
        return obj;
    }
    else
    {
        // if we can't find anything at this position,
        // find the previous and subsequent objects, and align the
        // lyrics with them.
        prev_obj = bobj.PreviousItem(voice_num, 'NoteRest');

        if (prev_obj != null)
        {
            // there should be an object registered here
            obj_id = voiceObjectPositions[prev_obj.Position];
            obj = libmei.getElementById(obj_id);
            return obj;
        }
        else
        {
            next_obj = bobj.NextItem(voice_num, 'NoteRest');

            if (next_obj != null)
            {
                obj_id = voiceObjectPositions[next_obj.Position];
                obj = libmei.getElementById(obj_id);
                return obj;
            }
        }
    }

    return null;
}  //$end

function AddBarObjectInfoToElement (bobj, element) {
    //$module(Utilities.mss)
    /*
        adds timing and position info (startids, endids, tstamps, etc.) to an element
        This info is mostly derived from the base BarObject class.
    */
    voicenum = bobj.VoiceNumber;
    bar = bobj.ParentBar;

    if (bobj.Type = 'Line')
    {
        // lines have durations, but symbols do not.
        if (bobj.Duration > 0)
        {
            libmei.AddAttribute(element, 'dur.ges', bobj.Duration & 'p');
        }
    }

    libmei.AddAttribute(element, 'tstamp', ConvertPositionToTimestamp(bobj.Position, bobj.ParentBar));

    if (bobj.Type = 'Line' or bobj.Type = 'Slur')
    {
        libmei.AddAttribute(element, 'tstamp2', ConvertPositionToTimestamp(bobj.EndPosition, bar));
    }

    libmei.AddAttribute(element, 'staff', bar.ParentStaff.StaffNum);
    libmei.AddAttribute(element, 'layer', voicenum);

    if (bobj.Dx > 0)
    {
        libmei.AddAttribute(element, 'ho', ConvertOffsetsToMillimeters(bobj.Dx));
    }

    if (bobj.Dy > 0)
    {
        libmei.AddAttribute(element, 'vo', ConvertOffsetsToMillimeters(bobj.Dy));
    }

    return element;

}  //$end

function TupletsEqual (t, t2) {
    //$module(Utilities.mss)

    // shamelessly copied from the built-in tuplet plugin.
    tIsBar = (t = null) or (t.Type = 'Bar');
    t2IsBar = (t2 = null) or (t2.Type = 'Bar');

    if( tIsBar and t2IsBar ) { return true; }
    if( tIsBar or t2IsBar ) { return false; }

    b = t.ParentBar;
    b2 = t2.ParentBar;

    if( b.BarNumber != b2.BarNumber ) { return false; }
    if( b.ParentStaff.StaffNum != b2.ParentStaff.StaffNum ) { return 0; }
    if( t.VoiceNumber != t2.VoiceNumber ) { return false; }

    if( t.Position != t2.Position ) { return false; }
    if( t.PlayedDuration != t2.PlayedDuration ) { return false; }

    return true;

}  //$end

function IsLastNoteInTuplet (bobj) {
    //$module(Utilities.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return false;
    }

    tuplet = bobj.ParentTupletIfAny;

    if (bobj.PositionInTuplet >= tuplet.Duration)
    {
        return true;
    }

    return false;

}  //$end

function lstrip (str) {
    //$module(Utilities.mss)
    if (utils.CharAt(str, 0) = ' ')
    {
        return Substring(str, 1);
    }
    else
    {
        return str;
    }
}  //$end

function rstrip (str) {
    //$module(Utilities.mss)
    if (utils.CharAt(str, Length(str) - 1) = ' ')
    {
        return Substring(str, 0, Length(str) - 1);
    }
    else
    {
        return str;
    }
}  //$end

function Log (message) {
    //$module(Utilities.mss)
    Sibelius.AppendLineToFile(LOGFILE, message, True);
}  //$end


Styles main roads at lower zoom levels

Styles main roads at lower zoom levels

@motorway:  #F56544;
@trunk:     @motorway;
@primary:   #FFC53C;
@secondary: @primary;
@road:      #ccc;
@track:     @road;
@footway:   #ac9;
@cycleway:  #9ca;

#roads::line {
  [zoom>=8][zoom<=12] {
    [type='motorway'] { line-color:@motorway; }
    [type='trunk'] { line-color:@trunk; }
    [type='motorway'],
    [type='trunk'] {
      line-cap:round;
      line-join:round;
      [zoom=11] { line-width:2; }
    }
  }
  [zoom=11] {
    [type='primary'] { line-color:@primary; }
    [type='secondary'] { line-color:@secondary; }
    [type='primary'],
    [type='secondary'] {
      line-cap:round;
      line-join:round;
      [zoom=11] { line-width:1.5; }
    }
  }
  [zoom>=12][zoom<=13] {
    [type='motorway_link'],
    [type='trunk_link'],
    [type='primary_link'],
    [type='secondary_link'],
    [type='tertiary'],
    [type='tertiary_link'],
    [type='unclassified'],
    [type='residential'],
    [type='living_street'] {
      line-color:@road;
      [zoom=12] { line-width:0.5; }
    }
  }
  [zoom>=14][zoom<=15] {
    [type='service'],
    [type='pedestrian'] {
      line-color:@road;
      [zoom=14] { line-width:0.5; }
    }
  }
  [zoom>=14] {
    [type='track'],
    [type='footway'],
    [type='bridleway'] {
      line-color:@footway;
      line-dasharray:4,1;
      line-cap:butt;
      [zoom=16] { line-width:1.2; }
      [zoom=17] { line-width:1.6; }
      [zoom>17] { line-width:2; }
    }
    [type='steps'] {
      line-color:@footway;
      line-dasharray:2,2;
      line-cap:butt;
      [zoom=16] { line-width:2; }
      [zoom=17] { line-width:3; }
      [zoom>17] { line-width:4; }
    }
    [type='cycleway'] {
      line-color: @cycleway;
      line-dasharray:4,1;
      line-cap:butt;
      [zoom=16] { line-width:1.2; }
      [zoom=17] { line-width:1.6; }
      [zoom>17] { line-width:2; }
    }
  }
}

#motorways::case[zoom>=6][zoom<=12],
#mainroads::case[zoom>=10][zoom<=12],
#roads::case[zoom>=13][tunnel!=1][bridge!=1],
#tunnels::case[zoom>=13][tunnel=1],
#bridges::case[zoom>=13][bridge=1] {
  // -- line style --
  line-cap:round;
  line-join:round;
  line-width:0;
  [tunnel=1] {
    line-cap:butt;
    line-dasharray:6,3;
  }
  [bridge=1] { line-color:@road * 0.8; }
  // -- colors --
  line-color:@road;
  [type='motorway'],
  [type='motorway_link'] {
    line-color:@motorway;
    [bridge=1] { line-color:@motorway * 0.8; }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color:@trunk;
    [bridge=1] { line-color:@trunk * 0.8; }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color:@primary;
    [bridge=1] { line-color:@primary * 0.8; }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color:@secondary;
    [bridge=1] { line-color:@secondary * 0.8; }
  }
  // -- widths --
  [type='motorway'],
  [type='trunk'] {
    [zoom=12] { line-width: 1.2 + 2; }
    [zoom=13] { line-width: 2 + 2; }
    [zoom=14] { line-width: 4 + 2; }
    [zoom=15] { line-width: 6 + 2; }
    [zoom=16] { line-width: 9 + 3; }
    [zoom=17] { line-width: 13 + 3; }
    [zoom>17] { line-width: 15 + 3; }
  }
  [type='primary'],
  [type='secondary'] {
    [zoom=12] { line-width: 1 + 2; }
    [zoom=13] { line-width: 1.2 + 2; }
    [zoom=14] { line-width: 2 + 2; }
    [zoom=15] { line-width: 4 + 2; }
    [zoom=16] { line-width: 7 + 3; }
    [zoom=17] { line-width: 9 + 3; }
    [zoom>17] { line-width: 11 + 3; }
  }
  [type='motorway_link'],
  [type='trunk_link'],
  [type='primary_link'],
  [type='secondary_link'],
  [type='tertiary'],
  [type='tertiary_link'],
  [type='unclassified'],
  [type='residential'],
  [type='living_street'] {
    [zoom=14] { line-width: 1.6 + 1.6; }
    [zoom=15] { line-width: 4 + 2; }
    [zoom=16] { line-width: 6 + 2; }
    [zoom=17] { line-width: 8 + 3; }
    [zoom>17] { line-width: 10 + 3; }
  }
  [type='service'],
  [type='pedestrian'] {
    [zoom=16] { line-width: 1.6 + 2; }
    [zoom=17] { line-width: 2 + 2; }
    [zoom>17] { line-width: 3 + 2.5; }
  }
}

#bridges::case[zoom>=13][bridge=1] {
  line-cap:butt;
}

#motorways::fill[zoom>=6][zoom<=12],
#mainroads::fill[zoom>=10][zoom<=12],
#roads::fill[zoom>=13][tunnel!=1][bridge!=1],
#tunnels::fill[zoom>=13][tunnel=1],
#bridges::fill[zoom>=13][bridge=1] {
  // -- line style --
  line-cap:round;
  line-join:round;
  line-width:0;
  // -- colors --
  line-color:lighten(@road,20);
  [type='motorway'],
  [type='motorway_link'] {
    line-color:lighten(@motorway,10);
    [tunnel=1] { line-color:@motorway * 0.5 + rgb(127,127,127); }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color:lighten(@trunk,10);
    [tunnel=1] { line-color:@trunk * 0.5 + rgb(127,127,127); }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color:lighten(@primary,20);
    [tunnel=1] { line-color:@primary * 0.5 + rgb(127,127,127); }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color:lighten(@secondary,20);
    [tunnel=1] { line-color:@secondary * 0.5 + rgb(127,127,127); }
  }
  // -- widths --
  [type='motorway'],
  [type='trunk'] {
    [zoom=12] { line-width: 1.2; }
    [zoom=13] { line-width: 2; }
    [zoom=14] { line-width: 4; }
    [zoom=15] { line-width: 6; }
    [zoom=16] { line-width: 9; }
    [zoom=17] { line-width: 13; }
    [zoom>17] { line-width: 15; }
  }
  [type='primary'],
  [type='secondary'] {
    [zoom=12] { line-width: 1; }
    [zoom=13] { line-width: 1.2; }
    [zoom=14] { line-width: 2; }
    [zoom=15] { line-width: 4; }
    [zoom=16] { line-width: 7; }
    [zoom=17] { line-width: 9; }
    [zoom>17] { line-width: 11; }
  }
  [type='motorway_link'],
  [type='trunk_link'],
  [type='primary_link'],
  [type='secondary_link'],
  [type='tertiary'],
  [type='tertiary_link'],
  [type='unclassified'],
  [type='residential'],
  [type='living_street'] {
    [zoom=14] { line-width: 1.6; }
    [zoom=15] { line-width: 4; }
    [zoom=16] { line-width: 6; }
    [zoom=17] { line-width: 8; }
    [zoom>17] { line-width: 10; }
  }
  [type='service'],
  [type='pedestrian'] {
    [zoom=16] { line-width: 1.6; }
    [zoom=17] { line-width: 2; }
    [zoom>17] { line-width: 3; }
  }
}

/* ---- ONE WAY ARROWS ---- */

#road-label::oneway_arrow[zoom>15][oneway=1] {
  marker-file:url("shape://arrow");
  marker-width:15;
  marker-placement:line;
  marker-line-width:1;
  marker-line-opacity:0.5;
  marker-line-color:#fff;
  marker-spacing: 200;
  marker-fill:spin(darken(@motorway,50),-10);
  marker-opacity:0.8;
}

@motorway:  #F56544;
@trunk:     @motorway;
@primary:   #FFC53C;
@secondary: @primary;
@road:      #ccc;
@track:     @road;
@footway:   #ac9;
@cycleway:  #9ca;

#roads::line {
  [zoom>=12][zoom<=13] {
    [type='motorway_link'],
    [type='trunk_link'],
    [type='primary_link'],
    [type='secondary_link'],
    [type='tertiary'],
    [type='tertiary_link'],
    [type='unclassified'],
    [type='residential'],
    [type='living_street'] {
      line-color:@road;
      [zoom=12] { line-width:0.5; }
    }
  }
  [zoom>=14][zoom<=15] {
    [type='service'],
    [type='pedestrian'] {
      line-color:@road;
      [zoom=14] { line-width:0.5; }
    }
  }
  [zoom>=14] {
    [type='track'],
    [type='footway'],
    [type='bridleway'] {
      line-color:@footway;
      line-dasharray:4,1;
      line-cap:butt;
      [zoom=16] { line-width:1.2; }
      [zoom=17] { line-width:1.6; }
      [zoom>17] { line-width:2; }
    }
    [type='steps'] {
      line-color:@footway;
      line-dasharray:2,2;
      line-cap:butt;
      [zoom=16] { line-width:2; }
      [zoom=17] { line-width:3; }
      [zoom>17] { line-width:4; }
    }
    [type='cycleway'] {
      line-color: @cycleway;
      line-dasharray:4,1;
      line-cap:butt;
      [zoom=16] { line-width:1.2; }
      [zoom=17] { line-width:1.6; }
      [zoom>17] { line-width:2; }
    }
  }
}

#motorways::case[zoom>=6][zoom<=12],
#mainroads::case[zoom>=10][zoom<=12],
#roads::case[zoom>=13][tunnel!=1][bridge!=1],
#tunnels::case[zoom>=13][tunnel=1],
#bridges::case[zoom>=13][bridge=1] {
  // -- line style --
  line-cap:round;
  line-join:round;
  line-width:0;
  [tunnel=1] {
    line-cap:butt;
    line-dasharray:6,3;
  }
  [bridge=1] { line-color:@road * 0.8; }
  // -- colors --
  line-color:@road;
  [type='motorway'],
  [type='motorway_link'] {
    line-color:@motorway;
    [bridge=1] { line-color:@motorway * 0.8; }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color:@trunk;
    [bridge=1] { line-color:@trunk * 0.8; }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color:@primary;
    [bridge=1] { line-color:@primary * 0.8; }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color:@secondary;
    [bridge=1] { line-color:@secondary * 0.8; }
  }
  // -- widths --
  [type='motorway'],
  [type='trunk'] {
    [zoom=12] { line-width: 1.2 + 2; }
    [zoom=13] { line-width: 2 + 2; }
    [zoom=14] { line-width: 4 + 2; }
    [zoom=15] { line-width: 6 + 2; }
    [zoom=16] { line-width: 9 + 3; }
    [zoom=17] { line-width: 13 + 3; }
    [zoom>17] { line-width: 15 + 3; }
  }
  [type='primary'],
  [type='secondary'] {
    [zoom=12] { line-width: 1 + 2; }
    [zoom=13] { line-width: 1.2 + 2; }
    [zoom=14] { line-width: 2 + 2; }
    [zoom=15] { line-width: 4 + 2; }
    [zoom=16] { line-width: 7 + 3; }
    [zoom=17] { line-width: 9 + 3; }
    [zoom>17] { line-width: 11 + 3; }
  }
  [type='motorway_link'],
  [type='trunk_link'],
  [type='primary_link'],
  [type='secondary_link'],
  [type='tertiary'],
  [type='tertiary_link'],
  [type='unclassified'],
  [type='residential'],
  [type='living_street'] {
    [zoom=14] { line-width: 1.6 + 1.6; }
    [zoom=15] { line-width: 4 + 2; }
    [zoom=16] { line-width: 6 + 2; }
    [zoom=17] { line-width: 8 + 3; }
    [zoom>17] { line-width: 10 + 3; }
  }
  [type='service'],
  [type='pedestrian'] {
    [zoom=16] { line-width: 1.6 + 2; }
    [zoom=17] { line-width: 2 + 2; }
    [zoom>17] { line-width: 3 + 2.5; }
  }
}

#bridges::case[zoom>=13][bridge=1] {
  line-cap:butt;
}

#motorways::fill[zoom>=6][zoom<=12],
#mainroads::fill[zoom>=10][zoom<=12],
#roads::fill[zoom>=13][tunnel!=1][bridge!=1],
#tunnels::fill[zoom>=13][tunnel=1],
#bridges::fill[zoom>=13][bridge=1] {
  // -- line style --
  line-cap:round;
  line-join:round;
  line-width:0;
  // -- colors --
  line-color:lighten(@road,20);
  [type='motorway'],
  [type='motorway_link'] {
    line-color:lighten(@motorway,10);
    [tunnel=1] { line-color:@motorway * 0.5 + rgb(127,127,127); }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color:lighten(@trunk,10);
    [tunnel=1] { line-color:@trunk * 0.5 + rgb(127,127,127); }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color:lighten(@primary,20);
    [tunnel=1] { line-color:@primary * 0.5 + rgb(127,127,127); }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color:lighten(@secondary,20);
    [tunnel=1] { line-color:@secondary * 0.5 + rgb(127,127,127); }
  }
  // -- widths --
  [type='motorway'],
  [type='trunk'] {
    [zoom=12] { line-width: 1.2; }
    [zoom=13] { line-width: 2; }
    [zoom=14] { line-width: 4; }
    [zoom=15] { line-width: 6; }
    [zoom=16] { line-width: 9; }
    [zoom=17] { line-width: 13; }
    [zoom>17] { line-width: 15; }
  }
  [type='primary'],
  [type='secondary'] {
    [zoom=12] { line-width: 1; }
    [zoom=13] { line-width: 1.2; }
    [zoom=14] { line-width: 2; }
    [zoom=15] { line-width: 4; }
    [zoom=16] { line-width: 7; }
    [zoom=17] { line-width: 9; }
    [zoom>17] { line-width: 11; }
  }
  [type='motorway_link'],
  [type='trunk_link'],
  [type='primary_link'],
  [type='secondary_link'],
  [type='tertiary'],
  [type='tertiary_link'],
  [type='unclassified'],
  [type='residential'],
  [type='living_street'] {
    [zoom=14] { line-width: 1.6; }
    [zoom=15] { line-width: 4; }
    [zoom=16] { line-width: 6; }
    [zoom=17] { line-width: 8; }
    [zoom>17] { line-width: 10; }
  }
  [type='service'],
  [type='pedestrian'] {
    [zoom=16] { line-width: 1.6; }
    [zoom=17] { line-width: 2; }
    [zoom>17] { line-width: 3; }
  }
}

/* ---- ONE WAY ARROWS ---- */

#road-label::oneway_arrow[zoom>15][oneway=1] {
  marker-file:url("shape://arrow");
  marker-width:15;
  marker-placement:line;
  marker-line-width:1;
  marker-line-opacity:0.5;
  marker-line-color:#fff;
  marker-spacing: 200;
  marker-fill:spin(darken(@motorway,50),-10);
  marker-opacity:0.8;
}


living_street as dotted green. make mid road classifications show up bolder on mid level zooms.

@path_halo_opacity: 0.7;
@path_halo_colour: white;

/* highway labels */
@highway_face_name: "Liberation Sans Regular";
@highway_text_fill: white;
@highway_halo_fill: black;
@highway_halo_radius: 2.0;

#highway-labels[highway='footway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='cycleway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='path'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='track'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

#highway-labels[highway='service'][zoom > 16] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='residential'][zoom > 15] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='unclassified'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='tertiary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='secondary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='primary'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='trunk'][zoom > 12] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='motorway'][zoom > 11] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

/* default style for all path, footway, track, cycleways and roads */
.highway {
  line-color: #000000;
  line-opacity: 0.5;
  line-join: round;
  line-cap: round;

  line-width: 1;
}

/* defaults for roads with cars */
.road[zoom > 11] {
  ::oneway_arrow[oneway='yes'][zoom > 14] {
    marker-type: arrow;

    marker-width: 2;
    marker-line-width: 2;

    marker-opacity: 1.0;
    marker-line-opacity: 1.0;

    marker-fill: white;
    marker-line-color: white;

    marker-spacing: 100;
  }

  line-color: #000000;
  line-join: round;
  line-cap: round;

  line-width: 1;

  [zoom > 17] { line-width: 15; line-opacity: 0.5; }
  [zoom = 17] { line-width: 10; line-opacity: 0.5; }
  [zoom = 16] { line-width: 5; line-opacity: 0.5; }
  [zoom = 15] { line-width: 2.25; line-opacity: 0.6; }
  [zoom = 14] { line-width: 1.5; line-opacity: 0.7; }
  [zoom = 13] { line-width: 1; line-opacity: 0.8; }
  [zoom = 12] { line-width: 0.5; line-opacity: 0.8; }

  ::bridge[bridge='yes'] {
    /*
    ideally we would draw two lines outside the existing line,
    but the current compositing method in mapnik won't allow this
    so easily with transparency

    line-color: #000000;
    line-opacity: 0.5;
    line-join: round;
    line-cap: round;

    [zoom > 17] { line-width: 20; }
    [zoom = 17] { line-width: 15; }
    [zoom = 16] { line-width: 7; }
    [zoom = 15] { line-width: 3; }
    [zoom = 14] { line-width: 2; }
    [zoom = 13] { line-width: 1.5; }
    [zoom = 12] { line-width: 0.75; }
    */
  }

}

.highway#footway[zoom > 13] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #FF0000;
  line-dasharray: 2,2;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

  [highway='steps']{
    line-cap: butt;

    [zoom > 18] { line-dasharray: 3,4 }
    [zoom = 18] { line-dasharray: 2,3 }
    [zoom < 18] { line-dasharray: 1,2 }
  }

}

.highway#path[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }
  line-color: #000000;
  line-dasharray: 2,2;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

}

.highway#track[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 16 }
    [zoom = 18] { line-width: 10 }
    [zoom = 17] { line-width: 6 }
    [zoom = 16] { line-width: 4.5 }
    [zoom = 15] { line-width: 3.2 }
    [zoom = 14] { line-width: 3 }
    [zoom = 13] { line-width: 2.4 }
  }

  line-color: #6d4f15;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 3,4 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 3,4 }
  [zoom = 16] { line-width: 2.1; line-dasharray: 3,4 }
  [zoom = 15] { line-width: 1.8; line-dasharray: 3,4 }
  [zoom = 14] { line-width: 1.5; line-dasharray: 3,4 }
  [zoom = 13] { line-width: 1.2  ; line-dasharray: 3,4 }

}

.highway#cycleway[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #0900ff;
  line-dasharray: 2,2;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

}

.road#service[zoom > 11] {
  [zoom > 17] { line-width: 7.5; }
  [zoom = 17] { line-width: 5; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 0.75; }
  [zoom = 13] { line-width: 0.5; }
  [zoom = 12] { line-width: 0.25; }

  [service='parking_aisle'][zoom > 14] {
    [zoom > 17] { line-width: 3; }
    [zoom = 17] { line-width: 2.5; }
    [zoom = 16] { line-width: 1.25; }
    [zoom = 15] { line-width: 0.25; }
  }
}

#turning-circle[zoom > 11] {
  marker-type: ellipse;
  marker-placement: point;

  marker-fill: #000000;
  marker-opacity: 0.5;
  marker-line-width: 0;

  [zoom > 17] { marker-width: 10; }
  [zoom = 17] { marker-width: 7.5; }
  [zoom = 16] { marker-width: 3.5; }
  [zoom = 15] { marker-width: 1.75; }
  [zoom = 14] { marker-width: 1; }
  [zoom = 13] { marker-width: 0.75; }
  [zoom = 12] { marker-width: 0.3; }
}

.road#residential[zoom > 11] {
  ::living_street[highway='living_street'][zoom > 14] {
    line-cap: butt;
    line-dasharray: 6,6;
    line-color: #76d276;
    line-opacity: 0.5;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  [zoom > 17] { line-width: 10; }
  [zoom = 17] { line-width: 7.5; }
  [zoom = 16] { line-width: 3.5; }
  [zoom = 15] { line-width: 1.75; }
  [zoom = 14] { line-width: 1; }
  [zoom = 13] { line-width: 0.75; }
  [zoom = 12] { line-width: 0.3; }

}

/* sets the colours for the road classification,
  but also draws the default line where .road doesn't apply
  ie. for zoom < 12 */
.road#unclassified{
}

.road#tertiary{
  line-color: #faf555;
}

.road#secondary{
  line-color: #d46833;
  [zoom = 12] { line-width: 1.0}
}

.road#primary{
  line-color: #cc3737;
  [zoom = 12] { line-width: 1.5}
}

.road#trunk{
  line-color: #243a7a;
  [zoom = 12] { line-width: 1.2}
}

.road#motorway{
  line-color: #7a2424;
  [zoom = 12] { line-width: 2.0}
}

@path_halo_opacity: 0.7;
@path_halo_colour: white;

/* highway labels */
@highway_face_name: "Liberation Sans Regular";
@highway_text_fill: white;
@highway_halo_fill: black;
@highway_halo_radius: 2.0;

#highway-labels[highway='footway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='cycleway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='path'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='track'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

#highway-labels[highway='service'][zoom > 16] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='residential'][zoom > 15] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='unclassified'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='tertiary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='secondary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='primary'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='trunk'][zoom > 12] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='motorway'][zoom > 11] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

/* default style for all path, footway, track, cycleways and roads */
.highway {
  line-color: #000000;
  line-opacity: 0.5;
  line-join: round;
  line-cap: round;

  line-width: 1;
}

/* defaults for roads with cars */
.road[zoom > 11] {
  ::oneway_arrow[oneway='yes'][zoom > 14] {
    marker-type: arrow;

    marker-width: 2;
    marker-line-width: 2;

    marker-opacity: 1.0;
    marker-line-opacity: 1.0;

    marker-fill: white;
    marker-line-color: white;

    marker-spacing: 100;
  }

  line-color: #000000;
  line-join: round;
  line-cap: round;

  line-width: 1;

  [zoom > 17] { line-width: 15; line-opacity: 0.5; }
  [zoom = 17] { line-width: 10; line-opacity: 0.5; }
  [zoom = 16] { line-width: 5; line-opacity: 0.5; }
  [zoom = 15] { line-width: 2.25; line-opacity: 0.6; }
  [zoom = 14] { line-width: 1.5; line-opacity: 0.7; }
  [zoom = 13] { line-width: 1; line-opacity: 0.8; }
  [zoom = 12] { line-width: 0.5; line-opacity: 0.8; }

  ::bridge[bridge='yes'] {
    /*
    ideally we would draw two lines outside the existing line,
    but the current compositing method in mapnik won't allow this
    so easily with transparency

    line-color: #000000;
    line-opacity: 0.5;
    line-join: round;
    line-cap: round;

    [zoom > 17] { line-width: 20; }
    [zoom = 17] { line-width: 15; }
    [zoom = 16] { line-width: 7; }
    [zoom = 15] { line-width: 3; }
    [zoom = 14] { line-width: 2; }
    [zoom = 13] { line-width: 1.5; }
    [zoom = 12] { line-width: 0.75; }
    */
  }

}

.highway#footway[zoom > 13] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #FF0000;
  line-dasharray: 2,2;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

  [highway='steps']{
    line-cap: butt;

    [zoom > 18] { line-dasharray: 3,4 }
    [zoom = 18] { line-dasharray: 2,3 }
    [zoom < 18] { line-dasharray: 1,2 }
  }

}

.highway#path[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }
  line-color: #000000;
  line-dasharray: 2,2;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

}

.highway#track[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 16 }
    [zoom = 18] { line-width: 10 }
    [zoom = 17] { line-width: 6 }
    [zoom = 16] { line-width: 4.5 }
    [zoom = 15] { line-width: 3.2 }
    [zoom = 14] { line-width: 3 }
    [zoom = 13] { line-width: 2.4 }
  }

  line-color: #6d4f15;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 3,4 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 3,4 }
  [zoom = 16] { line-width: 2.1; line-dasharray: 3,4 }
  [zoom = 15] { line-width: 1.8; line-dasharray: 3,4 }
  [zoom = 14] { line-width: 1.5; line-dasharray: 3,4 }
  [zoom = 13] { line-width: 1.2  ; line-dasharray: 3,4 }

}

.highway#cycleway[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #0900ff;
  line-dasharray: 2,2;
  line-opacity: 1.0;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom < 17] { line-width: 1.5; line-dasharray: 1,2 }

}

.road#service[zoom > 11] {
  [zoom > 17] { line-width: 7.5; }
  [zoom = 17] { line-width: 5; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 0.75; }
  [zoom = 13] { line-width: 0.5; }
  [zoom = 12] { line-width: 0.25; }

  [service='parking_aisle'][zoom > 14] {
    [zoom > 17] { line-width: 3; }
    [zoom = 17] { line-width: 2.5; }
    [zoom = 16] { line-width: 1.25; }
    [zoom = 15] { line-width: 0.25; }
  }
}

#turning-circle[zoom > 11] {
  marker-type: ellipse;
  marker-placement: point;

  marker-fill: #000000;
  marker-opacity: 0.5;
  marker-line-width: 0;

  [zoom > 17] { marker-width: 10; }
  [zoom = 17] { marker-width: 7.5; }
  [zoom = 16] { marker-width: 3.5; }
  [zoom = 15] { marker-width: 1.75; }
  [zoom = 14] { marker-width: 1; }
  [zoom = 13] { marker-width: 0.75; }
  [zoom = 12] { marker-width: 0.3; }
}

.road#residential[zoom > 11] {
  ::living_street[highway='living_street'][zoom > 14] {
    line-cap: square;
    line-dasharray: 3,3;
    line-color: #76d276;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  [zoom > 17] { line-width: 10; }
  [zoom = 17] { line-width: 7.5; }
  [zoom = 16] { line-width: 3.5; }
  [zoom = 15] { line-width: 1.75; }
  [zoom = 14] { line-width: 1; }
  [zoom = 13] { line-width: 0.75; }
  [zoom = 12] { line-width: 0.3; }

}

.road#unclassified{
}

.road#tertiary{
  line-color: #faf555;
}

.road#secondary{
  line-color: #d46833;
}

.road#primary{
  line-color: #cc3737;
}

.road#trunk{
  line-color: #243a7a;
}

.road#motorway{
  line-color: #7a2424;
}


Update version number

Update version number

This will be 2.0.2

Version     "2.0.2"
PluginName  "Sibelius to MEI Exporter"
Author      "Andrew Hankinson"

_InitialProgressTitle "Exporting %s to MEI"
_ExportFileIsNull "You must specify a file to save."
_ScoreError "Please open a score and try again."
_ExportSuccess "The file was exported successfully."
_ExportFailure "The file was not exported because of an error."
_VersionNotSupported "Versions earlier than Sibelius 7 are not supported."
_ExportingBars "Exporting to MEI: Bar %s of %s"

_ObjectAssignedToAllVoicesWarning "Bar %s, voice %s. %s assigned to all voices will be encoded on voice 1. If this is incorrect, you should explicitly assign this object to a voice."
_ObjectHasNoMEISupport "%s is not supported by MEI at this time."
_ObjectIsOnAnIllogicalObject "Bar %s, voice %s. %s is added to a %s object. This will create invalid MEI. You should fix this in your Sibelius file if possible, or edit your MEI file after export."

LOGFILE "/tmp/sibelius.log"

Version     "2.0.1"
PluginName  "Sibelius to MEI Exporter"
Author      "Andrew Hankinson"

_InitialProgressTitle "Exporting %s to MEI"
_ExportFileIsNull "You must specify a file to save."
_ScoreError "Please open a score and try again."
_ExportSuccess "The file was exported successfully."
_ExportFailure "The file was not exported because of an error."
_VersionNotSupported "Versions earlier than Sibelius 7 are not supported."
_ExportingBars "Exporting to MEI: Bar %s of %s"

_ObjectAssignedToAllVoicesWarning "Bar %s, voice %s. %s assigned to all voices will be encoded on voice 1. If this is incorrect, you should explicitly assign this object to a voice."
_ObjectHasNoMEISupport "%s is not supported by MEI at this time."
_ObjectIsOnAnIllogicalObject "Bar %s, voice %s. %s is added to a %s object. This will create invalid MEI. You should fix this in your Sibelius file if possible, or edit your MEI file after export."

LOGFILE "/tmp/sibelius.log"


suburb labels on zoom 13 larger but not CAPS

// country border
#locality-labels[admin_level='2'][zoom > 1][zoom < 6] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;
  [zoom = 2] { text-size: 25; }
  [zoom = 3] { text-size: 25; }
  [zoom = 4] { text-size: 25; }
  [zoom = 5] { text-size: 25; }
}

// state and territor borders
#locality-labels[admin_level='4'][zoom > 3][zoom < 7] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;
  [zoom = 4] { text-size: 25; }
  [zoom = 5] { text-size: 25; }
  [zoom = 6] { text-size: 25; }
}

// council/LGA borders
#locality-labels[admin_level='6'] {
}

// city
#locality-labels[place='city'][zoom > 5] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;

  [zoom>14] { text-size: 23px; }
  [zoom=14] { text-size: 18px; }
  [zoom<13] { text-size: 15px; }
}

// suburb borders
/*
don't add label for #locality-labels[place='suburb']
in Australia this will lead to lots of duplicates
*/
[zoom > 12] {
  #locality-labels[admin_level='9'],#locality-labels[admin_level='10'] {
    text-name: "[name]";
    text-face-name: "Liberation Sans Bold";
    text-fill: black;
    text-placement: point;
    text-halo-fill: white;
    text-allow-overlap: true;
    text-transform: uppercase;
    text-wrap-width: 50px;
    text-line-spacing: 6px;

    text-opacity: 0.8;

    [zoom>14] { text-size: 20; text-halo-radius: 2.0; }
    [zoom=14] { text-size: 12; text-halo-radius: 1.0; }
    [zoom=13] { text-size: 10; text-halo-radius: 1.0; text-transform: none; }
  }
}

[zoom > 11] #locality-labels[boundary='national_park'] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: green;
  text-placement: point;
  text-halo-fill: white;
  text-wrap-width: 50px;

  text-opacity: 0.8;

  [zoom>14] { text-size: 20; text-halo-radius: 2.0; }
  [zoom=14] { text-size: 16; text-halo-radius: 1.75; }
  [zoom=13] { text-size: 14; text-halo-radius: 1.5; }
  [zoom=12] { text-size: 12; text-halo-radius: 1.0; }
}

// country border
#locality-labels[admin_level='2'][zoom > 1][zoom < 6] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;
  [zoom = 2] { text-size: 25; }
  [zoom = 3] { text-size: 25; }
  [zoom = 4] { text-size: 25; }
  [zoom = 5] { text-size: 25; }
}

// state and territor borders
#locality-labels[admin_level='4'][zoom > 3][zoom < 7] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;
  [zoom = 4] { text-size: 25; }
  [zoom = 5] { text-size: 25; }
  [zoom = 6] { text-size: 25; }
}

// council/LGA borders
#locality-labels[admin_level='6'] {
}

// city
#locality-labels[place='city'][zoom > 5] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: white;
  text-placement: point;
  text-halo-fill: black;
  text-halo-radius: 2.0;
  text-allow-overlap: true;
  text-transform: uppercase;
  text-wrap-width: 50px;
  text-line-spacing: 6px;

  text-opacity: 0.8;

  [zoom>14] { text-size: 23px; }
  [zoom=14] { text-size: 18px; }
  [zoom<13] { text-size: 15px; }
}

// suburb borders
/*
don't add label for #locality-labels[place='suburb']
in Australia this will lead to lots of duplicates
*/
[zoom > 12] {
  #locality-labels[admin_level='9'],#locality-labels[admin_level='10'] {
    text-name: "[name]";
    text-face-name: "Liberation Sans Bold";
    text-fill: black;
    text-placement: point;
    text-halo-fill: white;
    text-allow-overlap: true;
    text-transform: uppercase;
    text-wrap-width: 50px;
    text-line-spacing: 6px;

    text-opacity: 0.8;

    [zoom>14] { text-size: 20; text-halo-radius: 2.0; }
    [zoom=14] { text-size: 12; text-halo-radius: 1.0; }
    [zoom=13] { text-size: 8; text-halo-radius: 1.0; }
  }
}

[zoom > 11] #locality-labels[boundary='national_park'] {
  text-name: "[name]";
  text-face-name: "Liberation Sans Bold";
  text-fill: green;
  text-placement: point;
  text-halo-fill: white;
  text-wrap-width: 50px;

  text-opacity: 0.8;

  [zoom>14] { text-size: 20; text-halo-radius: 2.0; }
  [zoom=14] { text-size: 16; text-halo-radius: 1.75; }
  [zoom=13] { text-size: 14; text-halo-radius: 1.5; }
  [zoom=12] { text-size: 12; text-halo-radius: 1.0; }
}