question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support VendorOption Tags

See original GitHub issue

PARSER

SLD

FEATUREREQUEST

Description:

I’m creating text symbolizers which look like this:

{
    color: "#000",
    font: ["Arial"],
    fontStyle: "normal",
    fontWeight: "bold",
    haloColor: "#fff",
    haloWidth: 1,
    kind: "Text",
    label: "{{name}}",
    size: 12
}

My backend is a geoserver instance and I need to send along some VendorOption tags which will control label placement. I know that these tags are not technically part of the SLD spec.

<VendorOption name="spaceAround">-1</VendorOption>

Here are the tags from the geoserver docs which I’m referring to: https://docs.geoserver.org/stable/en/user/styling/sld/reference/labeling.html#overlapping-and-separating-labels-spacearound

Would it be possible to extend text symbolizers so you could pass custom tags through? I would be willing to contribute a PR for this if this is possible and would be merged. I’m open to whatever means the owners think would be best to support this, if at all.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:35 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
glensellecommented, Jun 26, 2019
// simplified example of the parser class in `sld-parser`
class SldStyleParser {
  getTextSymbolizer() {
    return {
      label: '{{name}}'
    }
  }
}
// simplified example of the possible new parser class `geostyler-geoserver-sld-parser`
class GeoserverSldStyleParser extends SldStyleParser {
  getTextSymbolizer() {
    return {
      ...super.getTextSymbolizer(),
      vendorOptions: {
        spaceAround: -1
      }
    }
  }
}

// this obviously would be done internally...not a public API -- just an example
const parser = new GeoserverSldStyleParser()
parser.getTextSymbolizer()
// I don't know how we'd represent these vendor options in the resulting object
// but this is one way similar to the @jodygarnett example
// { label: '{{name}}', vendorOptions: { spaceAround: -1 } }
3reactions
glensellecommented, Nov 1, 2019

I thought I’d update this thread because we created the parser just like we talked about here. We’re currently in the process of getting approval from some internal folks before it can be made public. When it gets approved I’ll post back here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support VendorOption Tags · Issue #1118 - GitHub
My backend is a geoserver instance and I need to send along some VendorOption tags which will control label placement.
Read more >
Labeling — GeoServer 2.22.x User Manual
This section discusses the details of controlling label placement via the standard SLD options. It also describes a number of GeoServer enhanced options...
Read more >
GeoServer VendorOption for SLD to place labels overlapping ...
GeoServer wants to make your labels look nice. Weird enough: I don't. Using the VendorOptions in the SLD I figured out some of...
Read more >
Labeling — GeoServer 2.9.0 User Manual
Controlling where the WMS server places labels with SLD is bit complex. ... Geoserver fully supports the SLD specification plus adds a few...
Read more >
Walkthrough: Serving and styling a WMS with GeoServer
Also notice the tags marked VendorOption, which are not part of all SLDs but are supported by GeoServer as a special means of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found