0

I currently am using a Python label expression to label parcels. I have 4 fields labeled. About 60% of my polygons label correctly, and the rest display the code in the expression, but still label. There is no difference between the polygons that DO label correctly and those that don't. There are no differences in the joined data either. Does anyone know why the label expression is being displayed in two ways on the same polygon data? I can't figure it out.

Python label error

asked Aug 20, 2018 at 17:27
3
  • 1
    welcome to GIS SE! Which system are you using, ArcGIS or QGIS? Can you edit your question to include the expression you're using to label your features (also, any code you're using)? Commented Aug 20, 2018 at 17:37
  • as above, post your expression. do the labels adjust when you zoom in/out? Commented Aug 20, 2018 at 17:39
  • 1
    You need to find a workaround special characters like & . Commented Aug 20, 2018 at 18:58

1 Answer 1

3

As @FelixIP noted in a comment, it is likely the special character & that is causing you trouble. From the ArcMap help:

The ampersand (&) and angle bracket (<) are special characters and are not
valid in your text if formatting tags are used. Use the equivalent character
codes &amp; and &lt; instead.

http://desktop.arcgis.com/en/arcmap/10.3/map/working-with-text/using-text-formatting-tags-about-text-formatting-t.htm

You have not included your original label expression, so I can not suggest exact correction, but assuming your using ArcMap and the Python label parser, you would need to add .replace('&','&amp;') after any text field that may have & in the field's value. ex: [OwnerField].replace('&','&amp;') + '\n<CLR red=255'>' + ...

Or you could use field calculator on the original data to remove or replace the & in the data itself, but be warned the &amp; is only replaced with & automatically by ArcMap in labels when formatting tags (ex: <FNT ...> or <BOL>) are used. If no such formatting tags are used, the label would show on the map as LastName FirstName &amp; FirstName instead of the desired LastName FirstName & FirstName

answered Aug 20, 2018 at 20:42
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.