You can use the Reshape operation to modify the geometry column and then export the resulting scratch layer.
Converting Polygons to Points using Centroid
- Select the contents of your shapefile
- Exapand the shapefile entry in the catalog view and select the contents
- Select the layer (if you happen to have the shape file on screen)
- 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
- 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
- Press OK. A new scratch entry containing the result of the operation has been added to the scratch service in the Catalog view.
- Right click on the above scratch entry in the catalog view and select Export to open the Export Wizard
- Choose Resource to Shapefile and press Next>
- Provide a destination directory for your new shapefile
- Ensure that your scratch entry is checked off for export
- Press Finish
- 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
- Select the contents of your shapefile
- Exapand the shapefile entry in the catalog view and select the contents
- Select the layer (if you happen to have the shape file on screen)
- 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
- 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
- Press OK. A new scratch entry containing the result of the operation has been added to the scratch service in the Catalog view.
- Right click on the above scratch entry in the catalog view and select Export to open the Export Wizard
- Choose Resource to Shapefile and press Next>
- Provide a destination directory for your new shapefile
- Ensure that your scratch entry is checked off for export
- Press Finish
- 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.