Skip to main content
formatting
Source Link
Midavalo
  • 29.9k
  • 11
  • 51
  • 105

Assuming you are using ArcGIS for Desktop, in Labels>Expression>Help section states that you need concatenate HTML tags with field specifiers to be able to do such tricks:

  • Specify a conditional if-else statement. These functions label cities with their name in a large, red font if their population is equal to or exceeds 250,000 and in the default label font if the population is less than 250,000:

Specify a conditional if-else statement. These functions label cities with their name in a large, red font if their population is equal to or exceeds 250,000 and in the default label font if the population is less than 250,000:

Python

def FindLabel ( [NAME], [POPULATION] ):
  if long([POPULATION]) >= 250000:
    return "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else:
    return [NAME]
def FindLabel ( [NAME], [POPULATION] ):
  if long([POPULATION]) >= 250000:
    return "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else:
    return [NAME]

VBScript

Function FindLabel ([NAME], [POPULATION])
  if (cLng([POPULATION]) >= 250000) then
   FindLabel = "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else
     FindLabel = [NAME]
  end if
End Function
Function FindLabel ([NAME], [POPULATION])
  if (cLng([POPULATION]) >= 250000) then
   FindLabel = "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else
     FindLabel = [NAME]
  end if
End Function

JScript

function FindLabel ( [NAME], [POPULATION]  )
{
if (parseFloat([POPULATION]) >= 250000){
return ("<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>");
}
else
return ([NAME]);
}
function FindLabel ( [NAME], [POPULATION]  )
{
if (parseFloat([POPULATION]) >= 250000){
return ("<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>");
}
else
return ([NAME]);
}

Assuming you are using ArcGIS for Desktop, in Labels>Expression>Help section states that you need concatenate HTML tags with field specifiers to be able to do such tricks:

  • Specify a conditional if-else statement. These functions label cities with their name in a large, red font if their population is equal to or exceeds 250,000 and in the default label font if the population is less than 250,000:

Python

def FindLabel ( [NAME], [POPULATION] ):
  if long([POPULATION]) >= 250000:
    return "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else:
    return [NAME]

VBScript

Function FindLabel ([NAME], [POPULATION])
  if (cLng([POPULATION]) >= 250000) then
   FindLabel = "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else
     FindLabel = [NAME]
  end if
End Function

JScript

function FindLabel ( [NAME], [POPULATION]  )
{
if (parseFloat([POPULATION]) >= 250000){
return ("<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>");
}
else
return ([NAME]);
}

Assuming you are using ArcGIS for Desktop, in Labels>Expression>Help section states that you need concatenate HTML tags with field specifiers to be able to do such tricks:

Specify a conditional if-else statement. These functions label cities with their name in a large, red font if their population is equal to or exceeds 250,000 and in the default label font if the population is less than 250,000:

Python

def FindLabel ( [NAME], [POPULATION] ):
  if long([POPULATION]) >= 250000:
    return "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else:
    return [NAME]

VBScript

Function FindLabel ([NAME], [POPULATION])
  if (cLng([POPULATION]) >= 250000) then
   FindLabel = "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else
     FindLabel = [NAME]
  end if
End Function

JScript

function FindLabel ( [NAME], [POPULATION]  )
{
if (parseFloat([POPULATION]) >= 250000){
return ("<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>");
}
else
return ([NAME]);
}
Source Link
fatih_dur
  • 5k
  • 2
  • 18
  • 36

Assuming you are using ArcGIS for Desktop, in Labels>Expression>Help section states that you need concatenate HTML tags with field specifiers to be able to do such tricks:

  • Specify a conditional if-else statement. These functions label cities with their name in a large, red font if their population is equal to or exceeds 250,000 and in the default label font if the population is less than 250,000:

Python

def FindLabel ( [NAME], [POPULATION] ):
  if long([POPULATION]) >= 250000:
    return "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else:
    return [NAME]

VBScript

Function FindLabel ([NAME], [POPULATION])
  if (cLng([POPULATION]) >= 250000) then
   FindLabel = "<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>"
  else
     FindLabel = [NAME]
  end if
End Function

JScript

function FindLabel ( [NAME], [POPULATION]  )
{
if (parseFloat([POPULATION]) >= 250000){
return ("<CLR red='255'><FNT size = '14'>" + [NAME] + "</FNT></CLR>");
}
else
return ([NAME]);
}