4

I have a data table with a column 'names' that have street names with street type (Road, Lane, Street etc.). I need to get the names in a format like in column 'new_names'using field calculator in ArcGIS.

How can I do this?

enter image description here

10

Use a dictionary and if/else with list comprehension to replace the words:

Pre-logic:

def replacename( names, new_names):
    d = {'Lane':'Ln', 'Road':'Rd', 'Street':'St'}
    return ' '.join([d[word] if word in d else word for word in names.split()])

Call with:

replacename( !names!, !new_names!)

enter image description here

2

If you only want to use the abbreviations for labelling then you could investigate Using an abbreviation dictionary and the About abbreviating and truncating words page:

Abbreviation dictionaries allow the Maplex Label Engine to shorten long labels to fit within small spaces. When you use an abbreviation dictionary, the Maplex Label Engine first attempts to place the full text of the label, then abbreviates any words found in the dictionary for labels that could not be placed.

Abbreviation dictionaries are applied to individual label classes. The abbreviation is applied to a freestanding word or groups of words, not parts of words, with the exception of certain non-English words. Individual words, such as Road and Street, can be abbreviated as Rd or St, or longer strings, such as Post Office, can be abbreviated as PO. Portions of words are not abbreviated. For example, if you have a dictionary entry mapping Road as Rd, the label Roadrunner Road is abbreviated as Roadrunner Rd, not Rdrunner Rd. Labels containing text formatting tags are not abbreviated by the Maplex Label Engine.

  • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two). – Roman Perkhaliuk Dec 17 '18 at 8:23
1

Don't know a way to this through ArcMap whithout using python. But you can do it through excel. Use Table to Excel tool, then in excel use Find and Replace. And in arcmap join the excel back to the original table. If you don't have excel you can export the table to csv using Export Feature Attribute to ASCII tool, and then use OpenOffice.

  • There's already a python solution and the asker didin't preferred python solution (but the comment is deleted by now). – RistoYlem Dec 17 '18 at 9:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.