Exporting spatial data to a shapefile

By exporting spatial data, you can make it available in a standard file format to other applications. For example, you can export data to a shapefile, transfer the shapefile to a system hosting a geobrowser, and use the browser to display a visual representation of the data.

Before you begin

Ensure that your user ID holds the following privileges:
  • Privilege to execute a subselect that returns the results that you want to export
  • Privilege to write to the directory where the file to which you will be exporting data resides
  • Privilege to create a file to contain the exported data (required if such a file does not already exist)

To find out what these privileges are and how to obtain them, consult your database administrator.

About this task

You can export spatial data from:
  • Base tables
  • Result sets returned from a query of a view
  • Result sets returned from a query of a join or union of multiple tables
  • Result sets returned from a spatial function

Procedure

  1. To export data to a shapefile, call the ST_EXPORT_SHAPE procedure.
  2. Optional: Verify the information and the content of the shapefile by issuing the following command:
    db2se shape_info -fileName shapefile_name