Processing the Geometry in a Shapefile

You can use the Reshape operation to modify the geometry column and then export the resulting scratch layer.

Converting Polygons to Points using Centroid

  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. (example using countries.shp)

    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. Define the process desired for the the_geom expression (you can add and remove attribtues as desired):

    # Example of simplifying counteries.shp for use as a points
    the_geom=centroid(the_geom)
    CNTRY_NAME=CNTRY_NAME
    LONG_NAME=LONG_NAME

  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.

Converting Lines or Points into Polygons using Buffer

  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. (example using *cities.shp)

    the_geom=the_geom
    CITY_NAME=CITY_NAME
    GMI_ADMIN=GMI_ADMIN
    ADMIN_NAME=ADMIN_NAME
    FIPS_CNTRY=FIPS_CNTRY
    CNTRY_NAME=CNTRY_NAME
    STATUS=STATUS
    POP_RANK=POP_RANK
    POP_CLASS=POP_CLASS
    PORT_ID=PORT_ID

  3. Define the process desired for the the_geom expression (you can add and remove attribtues as desired):

    # Example of buffering cities.shp for use as a polygons
    the_geom=buffer(the_geom,0.01)
    CITY_NAME=CITY_NAME
    CNTRY_NAME=CNTRY_NAME
    POP_CLASS=POP_CLASS
    PORT_ID=PORT_ID

  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.