python

823
5
01-17-2021 05:45 AM
KalSsin
New Contributor III

fr.JPG

Hi~~~~

 

I would like to express it using Python as below.

I'd appreciate it if you could code it.

 

I would like to label “Paris” as follows.

 

def FindLabel ( [C-NAME]:

if [C-NAME]=="France":

 

In Beyond : None

Out Beyond : 1:15,000

 

"<CLR #BDBDBD'>" "<FNT name = 'Arial' size = '12'>" font style : bold

Outline color : #BDBDBD

Outline width : 0.3pt

 

Halo color : #BDBDBD

Halo Outline color : # D1D0CE

Halo Outline width : 0.3pt

 

 

 

I would like to label “Roma” as follows.

 

def FindLabel ( [C-NAME]:

if [C-NAME]=="Itlay":

 

In Beyond : 1:15,001

Out Beyond : 1:35,000

 

"<CLR #FF0000'>" "<FNT name = 'Arial' size = '12'>" font style : regular

Outline color : #BDBDBD

Outline width : 0.3pt

 

Halo color : #BDBDBD

Halo Outline color : # D1D0CE

Halo Outline width : 0.3pt

 

 

Thank you~~

 

0 Kudos
5 Replies
DavidPike
MVP Frequent Contributor

Are you intending this within the python label expression window or you want to achieve this using arcpy outside of the ArcGIS Pro interface?  I don't believe the visibility range can be set using a label expression, rather it would be applied as part of the labelling class.  

KalSsin
New Contributor III

Thank you so much~~~~

I want to label expression window. (no outside)

I have modified the contents below.

 

I would like to label “Paris” as follows.

 

def FindLabel ( [C-NAME]:

if [C-NAME]=="France":

 

"<CLR #BDBDBD'>" "<FNT name = 'Arial' size = '12'>" font style : bold

Outline color : #BDBDBD

Outline width : 0.3pt

 

Halo color : #BDBDBD

Halo Outline color : # D1D0CE

Halo Outline width : 0.3pt

 

I would like to label “Roma” as follows.

 

def FindLabel ( [C-NAME]:

if [C-NAME]=="Itlay":

 

 

"<CLR #FF0000'>" "<FNT name = 'Arial' size = '12'>" font style : regular

Outline color : #BDBDBD

Outline width : 0.3pt

 

Halo color : #BDBDBD

Halo Outline color : # D1D0CE

Halo Outline width : 0.3pt

0 Kudos
MehdiPira1
Esri Contributor

Hi @KalSsin 

This is an example of text formatting I used in my case:

 

 

def FindLabel ([Location_Status], [Speed]):
    locstat = str([Location_Status])
    if locstat == "Active":
        label = "<BOL><FNT size= '25' name = 'Arial'><CLR red='255' 
        green='236' blue='0' alpha='100'><BGD red='0' green='0' blue='0' 
        alpha='100'>" + str([Speed]) + "</BGD></CLR></FNT></BOL>"
        return label

 

 

I hope this gives you some insights on what options are available.

I couldn't find any scale ranging in python label expressions.

This is a useful link:

https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/text-formatting-tags.htm

Cheers

Mehdi

======================================================================

Please give a like if helpful and Accept as Solution if it's answered your query.

KalSsin
New Contributor III

thank you so much~~~~

0 Kudos
MehdiPira1
Esri Contributor

Hi @KalSsin 

if my reply has answered your question, would you please Accept as Solution?

Thank you.

0 Kudos