Skip to main content
fixed typo they->the
Source Link
ajashton
  • 641
  • 4
  • 6

Data properties can be used for filters in selectors (ie the #id[type='stop'] part), but TileMill cannot currently assign colors or most other property types based on values in the data.

Instead, you would have to create a filter to check the data, then assign the color manually:

#id[type='stop'] {
  [color='#ff0000'] { marker-line-color: #ff0000; }
  [color='#00ff00'] { marker-line-color: #00ff00; }
  // etc.
}

This is a limitation of Mapnik, the rendering engine behind TileMill. Support for assigning more values based on the data is a planned feature, but not yet available.

Currently theythe only style properties that can accept data values are:

  • marker-width
  • marker-height
  • text-orientation
  • building-height
  • shield-name
  • text-name
  • marker-file (within the URI)
  • shield-file (within the URI)
  • point-file (within the URI)

Since marker-file is supported, another option you have is creating a bunch of different SVG icons containing the appropriate color code in their name (eg stop-#ff0000.svg). Then you could have a style like this:

#id[type='stop'] {
  marker-file: url("icons/stop-[color].svg");
}

Data properties can be used for filters in selectors (ie the #id[type='stop'] part), but TileMill cannot currently assign colors or most other property types based on values in the data.

Instead, you would have to create a filter to check the data, then assign the color manually:

#id[type='stop'] {
  [color='#ff0000'] { marker-line-color: #ff0000; }
  [color='#00ff00'] { marker-line-color: #00ff00; }
  // etc.
}

This is a limitation of Mapnik, the rendering engine behind TileMill. Support for assigning more values based on the data is a planned feature, but not yet available.

Currently they only style properties that can accept data values are:

  • marker-width
  • marker-height
  • text-orientation
  • building-height
  • shield-name
  • text-name
  • marker-file (within the URI)
  • shield-file (within the URI)
  • point-file (within the URI)

Since marker-file is supported, another option you have is creating a bunch of different SVG icons containing the appropriate color code in their name (eg stop-#ff0000.svg). Then you could have a style like this:

#id[type='stop'] {
  marker-file: url("icons/stop-[color].svg");
}

Data properties can be used for filters in selectors (ie the #id[type='stop'] part), but TileMill cannot currently assign colors or most other property types based on values in the data.

Instead, you would have to create a filter to check the data, then assign the color manually:

#id[type='stop'] {
  [color='#ff0000'] { marker-line-color: #ff0000; }
  [color='#00ff00'] { marker-line-color: #00ff00; }
  // etc.
}

This is a limitation of Mapnik, the rendering engine behind TileMill. Support for assigning more values based on the data is a planned feature, but not yet available.

Currently the only style properties that can accept data values are:

  • marker-width
  • marker-height
  • text-orientation
  • building-height
  • shield-name
  • text-name
  • marker-file (within the URI)
  • shield-file (within the URI)
  • point-file (within the URI)

Since marker-file is supported, another option you have is creating a bunch of different SVG icons containing the appropriate color code in their name (eg stop-#ff0000.svg). Then you could have a style like this:

#id[type='stop'] {
  marker-file: url("icons/stop-[color].svg");
}
Source Link
ajashton
  • 641
  • 4
  • 6

Data properties can be used for filters in selectors (ie the #id[type='stop'] part), but TileMill cannot currently assign colors or most other property types based on values in the data.

Instead, you would have to create a filter to check the data, then assign the color manually:

#id[type='stop'] {
  [color='#ff0000'] { marker-line-color: #ff0000; }
  [color='#00ff00'] { marker-line-color: #00ff00; }
  // etc.
}

This is a limitation of Mapnik, the rendering engine behind TileMill. Support for assigning more values based on the data is a planned feature, but not yet available.

Currently they only style properties that can accept data values are:

  • marker-width
  • marker-height
  • text-orientation
  • building-height
  • shield-name
  • text-name
  • marker-file (within the URI)
  • shield-file (within the URI)
  • point-file (within the URI)

Since marker-file is supported, another option you have is creating a bunch of different SVG icons containing the appropriate color code in their name (eg stop-#ff0000.svg). Then you could have a style like this:

#id[type='stop'] {
  marker-file: url("icons/stop-[color].svg");
}