2

I've been trying to figure out different approaches to constructing circles with text inside of them in SLD/GeoServer. Single character font-based "external" symbols work fine, with the "text" part being e.g.:

<PointSymbolizer>
  <Graphic>
    <Mark>
      <WellKnownName>ttf://Arial#0x70</WellKnownName>
      <Fill>
        <CssParameter name="fill">#000000</CssParameter>
      </Fill>
    </Mark>
    <Size>7</Size>
  </Graphic>
</PointSymbolizer>

My question is, is it possible to combine several characters into one WellKnownName tag in the hex format? Haven't found anything at least in the SLD documentations / references. Or does one always have to generate several PointSymbolizer entities with single characters accompanied by some offset technique to generate multi-character text symbols? Looking for the cleanest, least-markup approach here.

For instance if I'd want a text "AA" inside a circle, the HEX code would be 4141, but so far it seems one can only single letters, e.g. ttf://Arial#0x41. At least ttf://Arial#0x4141 doesn't seem to work.

Of course one can create texts inside circles with TextSymbolizer but that runs into all kinds of label removal/placement issues.

1

Sadly TTFMarkFactory where the magic happens only handles a single TTF code at a time.

AFAIK the only way to do this is to implement a custom MarkFactory or an ExternalGraphicsFactory. There is a page of documentation here that should get you started.

Alternatively you could look at using SVG to define the marks you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.