shp2pgsql and IMPORT.
An
ogr2ogr version of 3.1.0 or higher is required to generate data that can be imported into CockroachDB.Please refer to the documentation of your GIS software for instructions on exporting GIS data to Shapefiles.
Before You Begin
To follow along with the example below, you will need the following prerequisites:Step 1. Download the Shapefile data
-
Download the tornado data:
-
Unzip the data file:
-
Change to the data folder:
Step 2. Convert the Shapefile data to SQL
To load the tornado Shapefile into CockroachDB, we must first convert it to SQL using theshp2pgsql tool:
Step 3. Host the files where the cluster can access them
Each node in the CockroachDB cluster needs to have access to the files being imported. There are several ways for the cluster to access the data; for a complete list of the types of storageIMPORT can pull from, see .
For local testing, you can . The following command will start a local file server listening on port 3000:
Step 4. Prepare the database
Next, create atornadoes database to store the data in, and switch to it:

