1

In ArcGIS Desktop 10.1 I created a new field to explain some zoning codes in an attribute Table. I basically want the new field "Zone" to have a string value based on the field "Zoning".

For example if the "Zoning" field value is "AG" then the corresponding "Zone" field should be "Agricultural".

I can do this easily in an Excel Sheet and bring it back to a Layer by a join, But I really want to know if there is a way to do this either with Python or VBScript using the Field Calculator.

The code may be something similar top the one below.

If [Zoning] = "AG" Then 
[Zone]= "Agricultural"

marked as duplicate by Curlew, Paul, BradHards, PolyGeo, Fezter Oct 17 '13 at 22:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

This should be fairly simple to do using the Python parser in Field Calculator. Right click on the [Zone] field header and select Field Calculator.

In your Pre-Logic Code block, put something like:

def zone_type(zone):
    if zone == "AG"
        type = "Agricultural"
    elif zone == "other zone"
        type = "other type"
    elif zone == "other zone" # Repeat for each additional zone
        type = "other type"   # and zone type
    return type

In your other code block, you should have something like:

Zone = zone_type(!Zoning!)
  • Thanks for your answer. I tried several times (few combination of different syntax) but it is not working – AlMazar Oct 17 '13 at 14:23
  • Here is my Code ( pre-logic and code block) def zone_type( zone ): if zone == "AG" type = "Agricultural" elif zone == "C1" type = "Neighborhood Commerciall" elif zone == "MF-1" type = "Multi Family" # and zone type return type zone_type(!Zoning!) – AlMazar Oct 17 '13 at 14:25
  • The links provided by @afalciano are useful resources as well. – Barbarossa Oct 17 '13 at 14:33

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