Converting full road names to abbreviation using ArcGIS field calculator?











up vote
1
down vote

favorite












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.



Can anybody help me?



enter image description here










share|improve this question




























    up vote
    1
    down vote

    favorite












    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.



    Can anybody help me?



    enter image description here










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      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.



      Can anybody help me?



      enter image description here










      share|improve this question















      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.



      Can anybody help me?



      enter image description here







      arcgis-desktop field-calculator python-parser address dictionary






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 44 mins ago









      PolyGeo

      53k1779238




      53k1779238










      asked 59 mins ago









      Roman Perkhaliuk

      607




      607






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Use a Dictionary and if/else with list comprehension to replace the words and join the list back to a string:



          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






          share|improve this answer






























            up vote
            0
            down vote













            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.







            share|improve this answer





















            • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
              – Roman Perkhaliuk
              22 mins ago


















            up vote
            -1
            down vote













            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.






            share|improve this answer





















            • You could rather point out how to do it in Python instead of presenting a workaround as a solution.
              – Erik
              11 mins ago











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "79"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f306219%2fconverting-full-road-names-to-abbreviation-using-arcgis-field-calculator%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Use a Dictionary and if/else with list comprehension to replace the words and join the list back to a string:



            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






            share|improve this answer



























              up vote
              2
              down vote



              accepted










              Use a Dictionary and if/else with list comprehension to replace the words and join the list back to a string:



              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






              share|improve this answer

























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                Use a Dictionary and if/else with list comprehension to replace the words and join the list back to a string:



                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






                share|improve this answer














                Use a Dictionary and if/else with list comprehension to replace the words and join the list back to a string:



                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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 39 mins ago

























                answered 46 mins ago









                BERA

                14.3k51839




                14.3k51839
























                    up vote
                    0
                    down vote













                    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.







                    share|improve this answer





















                    • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                      – Roman Perkhaliuk
                      22 mins ago















                    up vote
                    0
                    down vote













                    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.







                    share|improve this answer





















                    • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                      – Roman Perkhaliuk
                      22 mins ago













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    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.







                    share|improve this answer












                    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.








                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 39 mins ago









                    PolyGeo

                    53k1779238




                    53k1779238












                    • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                      – Roman Perkhaliuk
                      22 mins ago


















                    • Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                      – Roman Perkhaliuk
                      22 mins ago
















                    Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                    – Roman Perkhaliuk
                    22 mins ago




                    Thank you for an answer. Maplex Label Engine - works badly when exporting in Illustrator (that's my stage two).
                    – Roman Perkhaliuk
                    22 mins ago










                    up vote
                    -1
                    down vote













                    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.






                    share|improve this answer





















                    • You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                      – Erik
                      11 mins ago















                    up vote
                    -1
                    down vote













                    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.






                    share|improve this answer





















                    • You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                      – Erik
                      11 mins ago













                    up vote
                    -1
                    down vote










                    up vote
                    -1
                    down vote









                    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.






                    share|improve this answer












                    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.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 34 mins ago









                    RistoYlem

                    643




                    643












                    • You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                      – Erik
                      11 mins ago


















                    • You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                      – Erik
                      11 mins ago
















                    You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                    – Erik
                    11 mins ago




                    You could rather point out how to do it in Python instead of presenting a workaround as a solution.
                    – Erik
                    11 mins ago


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f306219%2fconverting-full-road-names-to-abbreviation-using-arcgis-field-calculator%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido