[Geoserver-users] YSLD Styling Help Needed

I am trying to create a style that uses line casings to deferinate highway types and surface types.
The two types of highways appear as the correct color. But the surface line is always white. (White is the color used for a null value in surface.) The legend created geoserver is correct.

I’m using geoserver 2.10-snapshot

My data looks has name, highway, and surface fields.

Any suggestions on how to fix?

Thanks in advance,
Clifford

My YSLD script:

define: &track ‘#4E302F
define: &unclassified ‘#477443
define: &gravel ‘#2B4428
define: &asphalt ‘#6E7B8B
define: &paved ‘#544B8D
define: &concrete ‘#7FB299
name: USFS
title: ‘USFS Roads’
feature-styles:

  • name: highway
    rules:
  • name: unclassified
    scale: [‘32000.0’, max]
    filter: ${highway = ‘unclassified’}
    symbolizers:
  • line:
    stroke-color: *unclassified
    stroke-width: 3
  • name: unclassified
    scale: [min, ‘32000.0’]
    filter: ${highway = ‘unclassified’}
    symbolizers:
  • line:
    stroke-color: *unclassified
    stroke-width: 7
  • name: track
    scale: [‘32000.0’, max]
    filter: ${highway = ‘track’}
    symbolizers:
  • line:
    stroke-color: *track
    stroke-width: 3
  • name: track
    scale: [min, ‘32000.0’]
    filter: ${highway = ‘track’}
    symbolizers:
  • line:
    stroke-color: *track
    stroke-width: 7
  • name: surface
    rules:
  • name: gravel
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘gravel’}
    symbolizers:
  • line:
    stroke-color: black
    stroke-width: 3
  • name: asphalt
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘asphalt’}
    symbolizers:
  • line:
    stroke-color: *asphalt
    stroke-width: 3
  • name: paved
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘paved’}
    symbolizers:
  • line:
    stroke-color: *paved
    stroke-width: 3
  • name: concrete
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘concrete’}
    symbolizers:
  • line:
    stroke-color: *concrete
    stroke-width: 3
  • name: unknown
    scale: [min, ‘32000.0’]
    filter: ${surface is null}
    symbolizers:
  • line:
    stroke-color: white
    stroke-width: 3
  • name: label
    rules:
  • scale: [min, ‘32000.0’]
    symbolizers:
  • line:
    stroke-color: ‘#FFFFFF
    stroke-width: 4
    stroke-linejoin: mitre
    stroke-linecap: round
  • scale: [min, ‘32000.0’]
    symbolizers:
  • text:
    label: ${street}
    fill-color: ‘#FFFFFF
    font-family: Times New Roman
    font-size: 12
    font-style: Normal
    font-weight: bold
    placement: line
    halo:
    fill-color: ‘#000000
    radius: 1
    offset: 10
    x-followLine: true
    x-group: true
···

@osm_seattle

osm_seattle.snowandsnow.us
OpenStreetMap: Maps with a human touch

Hi Clifford,

After modifying your style to fit some sample data I had, I think I found the problem - In your label feature-type, you have an always active white line (for scales less than 32000):

  • name: label
    rules:
  • scale: [min, ‘32000.0’]
    symbolizers:
  • line:
    stroke-color: ‘#FFFFFF
    stroke-width: 4
    stroke-linejoin: mitre
    stroke-linecap: round
  • scale: [min, ‘32000.0’]
    symbolizers:
  • text:
    label: ${street}
    fill-color: ‘#FFFFFF
    font-family: Times New Roman
    font-size: 12
    font-style: Normal
    font-weight: bold
    placement: line
    halo:
    fill-color: ‘#000000
    radius: 1
    offset: 10
    x-followLine: true
    x-group: true

If this isn’t the issue, I have one other suggestion - YSLD is case-sensitive, so double-check the case of your properties (e.g. surface) and the values you are comparing them with.

Cheers,

Torben

···

On Thu, Mar 22, 2018 at 12:26 PM, Clifford Snow <clifford@anonymised.com> wrote:

I am trying to create a style that uses line casings to deferinate highway types and surface types.
The two types of highways appear as the correct color. But the surface line is always white. (White is the color used for a null value in surface.) The legend created geoserver is correct.

I’m using geoserver 2.10-snapshot

My data looks has name, highway, and surface fields.

Any suggestions on how to fix?

Thanks in advance,
Clifford

My YSLD script:

define: &track ‘#4E302F
define: &unclassified ‘#477443
define: &gravel ‘#2B4428
define: &asphalt ‘#6E7B8B
define: &paved ‘#544B8D
define: &concrete ‘#7FB299
name: USFS
title: ‘USFS Roads’
feature-styles:

  • name: highway
    rules:
  • name: unclassified
    scale: [‘32000.0’, max]
    filter: ${highway = ‘unclassified’}
    symbolizers:
  • line:
    stroke-color: *unclassified
    stroke-width: 3
  • name: unclassified
    scale: [min, ‘32000.0’]
    filter: ${highway = ‘unclassified’}
    symbolizers:
  • line:
    stroke-color: *unclassified
    stroke-width: 7
  • name: track
    scale: [‘32000.0’, max]
    filter: ${highway = ‘track’}
    symbolizers:
  • line:
    stroke-color: *track
    stroke-width: 3
  • name: track
    scale: [min, ‘32000.0’]
    filter: ${highway = ‘track’}
    symbolizers:
  • line:
    stroke-color: *track
    stroke-width: 7
  • name: surface
    rules:
  • name: gravel
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘gravel’}
    symbolizers:
  • line:
    stroke-color: black
    stroke-width: 3
  • name: asphalt
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘asphalt’}
    symbolizers:
  • line:
    stroke-color: *asphalt
    stroke-width: 3
  • name: paved
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘paved’}
    symbolizers:
  • line:
    stroke-color: *paved
    stroke-width: 3
  • name: concrete
    scale: [min, ‘32000.0’]
    filter: ${surface = ‘concrete’}
    symbolizers:
  • line:
    stroke-color: *concrete
    stroke-width: 3
  • name: unknown
    scale: [min, ‘32000.0’]
    filter: ${surface is null}
    symbolizers:
  • line:
    stroke-color: white
    stroke-width: 3
  • name: label
    rules:
  • scale: [min, ‘32000.0’]
    symbolizers:
  • line:
    stroke-color: ‘#FFFFFF
    stroke-width: 4
    stroke-linejoin: mitre
    stroke-linecap: round
  • scale: [min, ‘32000.0’]
    symbolizers:
  • text:
    label: ${street}
    fill-color: ‘#FFFFFF
    font-family: Times New Roman
    font-size: 12
    font-style: Normal
    font-weight: bold
    placement: line
    halo:
    fill-color: ‘#000000
    radius: 1
    offset: 10
    x-followLine: true
    x-group: true

@osm_seattle

osm_seattle.snowandsnow.us
OpenStreetMap: Maps with a human touch


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@anonymised.com.382…sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users