Friday, 22 February 2019

arcgis desktop - How to prevent automatic new line when labeling point feature class?


I have a point feature class that I am labelling with the string "EXIT" for a majority of points, but some points will be longer, such as "EXIT into Pacific".


I wrote a labeling script that will create a new line after "EXIT", but not after "into" because I want to keep "into Pacific" on one line.


I want the label to show up like this:


     EXIT
into Pacific


But instead, it automatically creates a new line and shows up like this:


     EXIT
into
Pacific

Is there a way to keep ArcMap from automatically creating a new line for the label? Or is there a good invisible character that will make the program think that "into Pacific" is one string with no white space?


Here's my script:


function FindLabel ([TYPE]){
var exitSlice
var intoSlice

intoSlice = ""
var label
var field
field = [TYPE]
exitSlice = field.slice(0, 4)
if (field.length > 4) {
intoSlice = field.slice(5)
label = exitSlice + "\n" + "" + intoSlice + ""
}
else {

label = exitSlice
}
return label}

I'm pretty confident the script isn't causing the extra newline between "into" and "Pacific".




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...