Adding a column to a shapefile

You can use the Reshape operation to generate additional attributes and then export the resulting scratch layer.

  1. Select the contents of your shapefile
  2. Run the Reshape operations, this operation will show you a the current attributes along with a definition of how to populate them.

    the_geom=the_geom
    FIPS_CNTRY=FIPS_CNTRY
    GMI_CNTRY=GMI_CNTRY
    ISO_2DIGIT=ISO_2DIGIT
    ISO_3DIGIT=ISO_3DIGIT
    CNTRY_NAME=CNTRY_NAME
    LONG_NAME=LONG_NAME
    SOVEREIGN=SOVEREIGN
    POP_CNTRY=POP_CNTRY
    CURR_TYPE=CURR_TYPE
    CURR_CODE=CURR_CODE
    LANDLOCKED=LANDLOCKED
    SQKM=SQKM
    SQMI=SQMI
    COLOR_MAP=COLOR_MAP

  3. Add a new line at the bottom:

    the_geom=the_geom
    FIPS_CNTRY=FIPS_CNTRY
    GMI_CNTRY=GMI_CNTRY
    ISO_2DIGIT=ISO_2DIGIT
    ISO_3DIGIT=ISO_3DIGIT
    CNTRY_NAME=CNTRY_NAME
    LONG_NAME=LONG_NAME
    SOVEREIGN=SOVEREIGN
    POP_CNTRY=POP_CNTRY
    CURR_TYPE=CURR_TYPE
    CURR_CODE=CURR_CODE
    LANDLOCKED=LANDLOCKED
    SQKM=SQKM
    SQMI=SQMI
    COLOR_MAP=COLOR_MAP
    DENSITY=POP_CNTRY/SQKM

  4. Press OK. A new scratch entry containing the result of the operation has been added to the scratch service in the Catalog view.
  5. Right click on the above scratch entry in the catalog view and select Export to open the Export Wizard
  6. Choose Resource to Shapefile and press Next>
  7. Provide a destination directory for your new shapefile
  8. Ensure that your scratch entry is checked off for export
  9. Press Finish
  10. The new shapefile is now available in the Catalog view

You can define additional columns using any CQL expression, please be advised that the shapefile format can only support one geometry column.

(c) Copyright (c) 2004-2008 Refractions Research Inc. and others.