Skip to main content
deleted 189 characters in body; edited tags; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

ArcGIS Python Labelling Conundrumusing Python Parser in ArcGIS Desktop?

Long-time reader, first-time poster, hello!

I have a head-scratcher (due to my limited expertise with Python) and I'm hoping someone can help me. I

I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL queries / label expressions, and I really hope there is a way to accomplish this more elegantly and efficiently, ideally with just 1 label expression.

My input data (which cannot be altered) is a feature class with 3 relevant fields (which I've made generic here).
Codelist - numeric codes Attribute1 - an attribute Attribute2 - a second attribute

  • Codelist - numeric codes
  • Attribute1 - an attribute
  • Attribute2 - a second attribute

Codelist contains 100 numbers. Groups of these numbers require one label - for example codes 1,3,35,7,8 would get the label "Christmas, Attribute1, Attribute2" on 3 separate lines. Codes 2,9,34,100,54,22 would get the label "Easter, Attribute 1, Attribute2" on 3 separate lines. Etc etc.

I can't figure out how to use an SQL-like 'if [CODELIST] in (1,3,35,7,8):' statement in the Python label expression builder. Is

Is it possible? Am

Am I approaching this the right way or is my first effort using multiple annotation classes and SQL queries the best way to do this after all?

I'd be happy to provide more details to anyone willing to help me out! Thanks in advance!

ArcGIS Python Labelling Conundrum

Long-time reader, first-time poster, hello!

I have a head-scratcher (due to my limited expertise with Python) and I'm hoping someone can help me. I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL queries / label expressions, and I really hope there is a way to accomplish this more elegantly and efficiently, ideally with just 1 label expression.

My input data (which cannot be altered) is a feature class with 3 relevant fields (which I've made generic here).
Codelist - numeric codes Attribute1 - an attribute Attribute2 - a second attribute

Codelist contains 100 numbers. Groups of these numbers require one label - for example codes 1,3,35,7,8 would get the label "Christmas, Attribute1, Attribute2" on 3 separate lines. Codes 2,9,34,100,54,22 would get the label "Easter, Attribute 1, Attribute2" on 3 separate lines. Etc etc.

I can't figure out how to use an SQL-like 'if [CODELIST] in (1,3,35,7,8):' statement in the Python label expression builder. Is it possible? Am I approaching this the right way or is my first effort using multiple annotation classes and SQL queries the best way to do this after all?

I'd be happy to provide more details to anyone willing to help me out! Thanks in advance!

Labelling using Python Parser in ArcGIS Desktop?

I have limited expertise with Python.

I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL queries / label expressions, and I really hope there is a way to accomplish this more elegantly and efficiently, ideally with just 1 label expression.

My input data (which cannot be altered) is a feature class with 3 relevant fields (which I've made generic here).

  • Codelist - numeric codes
  • Attribute1 - an attribute
  • Attribute2 - a second attribute

Codelist contains 100 numbers. Groups of these numbers require one label - for example codes 1,3,35,7,8 would get the label "Christmas, Attribute1, Attribute2" on 3 separate lines. Codes 2,9,34,100,54,22 would get the label "Easter, Attribute 1, Attribute2" on 3 separate lines. Etc etc.

I can't figure out how to use an SQL-like 'if [CODELIST] in (1,3,35,7,8):' statement in the Python label expression builder.

Is it possible?

Am I approaching this the right way or is my first effort using multiple annotation classes and SQL queries the best way to do this after all?

Source Link

ArcGIS Python Labelling Conundrum

Long-time reader, first-time poster, hello!

I have a head-scratcher (due to my limited expertise with Python) and I'm hoping someone can help me. I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL queries / label expressions, and I really hope there is a way to accomplish this more elegantly and efficiently, ideally with just 1 label expression.

My input data (which cannot be altered) is a feature class with 3 relevant fields (which I've made generic here).
Codelist - numeric codes Attribute1 - an attribute Attribute2 - a second attribute

Codelist contains 100 numbers. Groups of these numbers require one label - for example codes 1,3,35,7,8 would get the label "Christmas, Attribute1, Attribute2" on 3 separate lines. Codes 2,9,34,100,54,22 would get the label "Easter, Attribute 1, Attribute2" on 3 separate lines. Etc etc.

I can't figure out how to use an SQL-like 'if [CODELIST] in (1,3,35,7,8):' statement in the Python label expression builder. Is it possible? Am I approaching this the right way or is my first effort using multiple annotation classes and SQL queries the best way to do this after all?

I'd be happy to provide more details to anyone willing to help me out! Thanks in advance!