NYU has the following GeoServer instances:
This section show you how to make a shapefile available as a GeoServer layer via a PostGIS table.
For these steps you will need the following tools installed:
ogr2ogr
- provided by gdalshp2pgsql
- provided by PostGISpsql
- provided by PostgreSQL
On macOS you can install these using Homebrew:
$ brew install gdal
$ brew install postgis
$ brew install postgresql
First we need to re-project the vector data to EPSG:4326 (WGS84).
To view the Shapefile's current CRS, use the following command and look for the SOURCECRS
entry.
$ ogrinfo -so -al original.shp
To re-project the Shapefile to EPSG:4326 use the following command:
$ ogr2ogr -t_srs EPSG:4326 -lco ENCODING=UTF-8 reprojected.shp original.shp
Next we need to convert our Shapefile into a file of SQL statements that will create a table and populate it with records:
$ shp2pgsql -I -s 4326 reprojected.shp table_name > table_name.sql
Finally, we run the SQL file against the PostGIS database:
$ psql --host=HOSTNAME_HERE --username=USERNAME_HERE --dbname=geospatial_data --file=table_name.sql
After logging into your desired GeoServer instance, do the following:
- Under Data click on Layers.
- Click on Add a new layer.
- In Add layer from select
sdr:vector_postgis
. - In the list of available layers, filter for the layer you want to add.
- Click Publish next to the layer you want to publish.
- Scroll down to Bounding Boxes:
- For Native Bounding Box click Compute from data.
- For Lat/Lon Bounding Box click Compute from native bounds.
- Click Save.
- In the sidebar click on Layer Review.
- Search for your layer in the resulting list.
- Click on OpenLayers in that result's row.
After logging into your desired GeoServer instance, do the following:
- Under Data click on Layers.
- Use the search box to find the Layer you want to remove
- Check the box in the first column of the row.
- Click Remove selected layers.
- Click OK in the confirmation dialog.