Exporting spatial data from a table

You can export spatial data from a table in your Vertica database to a shapefile.

You can export spatial data from a table in your Vertica database to a shapefile.

To export spatial data from a table to a shapefile:

  1. As the superuser., set the shapefile export directory.

    => SELECT STV_SetExportShapefileDirectory(USING PARAMETERS path = '/home/geo/temp');
                   STV_SetExportShapefileDirectory
    ------------------------------------------------------------
     SUCCESS. Set shapefile export directory: [/home/geo/temp]
    (1 row)
    
  2. Export your spatial data to a shapefile.

    => SELECT STV_Export2Shapefile(*
                  USING PARAMETERS shapefile = 'visualizations/city-data.shp',
                                shape = 'Polygon') OVER() FROM spatial_data;
     Rows Exported |                          File Path
    ---------------+----------------------------------------------------------------
           185873 | v_geo-db_node0001: /home/geo/temp/visualizations/city-data.shp
    (1 row)
    
    • The value asterisk (*) is the equivalent to listing all columns in the FROM clause.

    • You can specify sub-directories when exporting your shapefile.

    • Your shapefile must end with the file extension .shp.

  3. Verify that three files now appear in the shapefile export directory.

    $ ls
    city-data.dbf  city-data.shp   city-data.shx