I've used SLD to label polygon features with their parcel Ids. The problem is for Ids include '.' and '-' marks, the ordering of character is messed up. For example 39.1 changes to 139. I've checked them in Pgsql and ArcMap which show them correctly.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:se="http://www.opengis.net/se" xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd">

          <se:Name>Single symbol</se:Name>
              <se:SvgParameter name="stroke">#7e7e7e</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.7</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
              <ogc:Function name="centroid">
              <se:SvgParameter name="font-family">Iranian Sans</se:SvgParameter>
              <se:SvgParameter name="font-size">11</se:SvgParameter>
              <se:SvgParameter name="font-weight">normal</se:SvgParameter>
              <se:SvgParameter name="fill">#523735</se:SvgParameter>
            <se:VendorOption name="autoWrap">150</se:VendorOption>
            <se:VendorOption name="maxDisplacement">50</se:VendorOption>
            <se:VendorOption name="group">yes</se:VendorOption>


I should mention that I've translated English numbers to Arabic format using python and inserted them in a new field. Is it something wrong with that process?

  • Does Iranian sans have a - & . character? – Ian Turton Oct 21 '18 at 19:06
  • @IanTurton yes it includes those characters and for other labels from osm data it works properly. – nasser tahani Oct 22 '18 at 7:41
  • do they show up correctly if you use a different font? – Ian Turton Oct 22 '18 at 7:53
  • @IanTurton nope, but they show up correctly in Postgresql, QGIS and python. – nasser tahani Oct 22 '18 at 9:48
  • then we need a small sample of the file to test with – Ian Turton Oct 22 '18 at 9:51

The problem was about the converting process of IDs to Arabic numbering format. I explored that there are two different Unicode types for Arabic numbers as stated here. In my method, all numbers should have been followed the same Unicode group such as (\xd9... or \xdb...) which I've fixed it and IDs show up properly.

def enToFaNumber(letter):
    charDict = {'0': '۰', '1': '۱', '2': '۲', '3': '۳', '4': '۴', '5': '۵', '6': '۶', '7': '۷', '8': '۸', '9': '۹',
                '.': '/'}
    char = charDict.get(letter)
    if char is None:
        return letter.encode('utf-8')

    return char

I can't reproduce this with the GeoServer topp:States layer, using the following SLD:

          <CssParameter name="font-family">Iranian Sans</CssParameter>
          <CssParameter name="font-size">11</CssParameter>
          <CssParameter name="font-weight">normal</CssParameter>
          <CssParameter name="fill">#523735</CssParameter>
        <VendorOption name="autoWrap">150</VendorOption>
        <VendorOption name="maxDisplacement">50</VendorOption>
        <VendorOption name="group">yes</VendorOption>

I get this map:

enter image description here

So it may be related to the python modification you are doing, if you can reproduce it with an included dataset, or with a small sample of your data feel free to open a GeoServer bug.

  • Thanks Ian the problem was about converting script and it's not a bug. – nasser tahani Oct 22 '18 at 11:01

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.