Load ESRI Shapefile

Preparing the Shapefile

When we loaded the shapefile into PostGIS earlier, we did so using shp2pgsql and the files remained zipped.

For creating a Store from a shapefile, we need to unzip the contents.

Connect via SSH and navigate to the //opt//data directory:

root@demo:~# cd /opt/data

Listing the contents, we see the three .zip file containing our data

root@demo:/opt/data# ls
neighborhoods.zip  parks.zip  waterways.zip

Unzip the waterways.zip file using ‘unzip -q waterways.zip’

root@demo:/opt/data# unzip -q waterways.zip

The contents are now unzipped:

root@demo:/opt/data# ls
neighborhoods.zip  waterways.dbf  waterways.shp  waterways.zip
parks.zip          waterways.prj  waterways.shx

Create Shapefile Store

1. Go to Stores > Add New Store and click the Shapefile link:

../../_images/da-shpfile-6.png

2. For Workspace, select ‘postgis’ and enter ‘postgishp” for the name and description

../../_images/da-shpfile.png

3. In the Connection Parameters, click the browse link

../../_images/da-shpfile-1.png

4. For shapefile location, select // from the dropdown

../../_images/da-shpfile-2.png

5. Navigate to //opt//data and select the waterways.shp file

../../_images/da-shpfile-3.png

6. Click the Save button

../../_images/da-shpfile-4.png

7. On the New Layer screen, click the Publish link

../../_images/da-shpfile-5.png

Enter the information as we did previously in Create Store