How to Publish the Data from PostGIS Database with GeoServer.

Eakphisitdha Uttra
3 min readNov 21, 2023

--

How to Publish the Data from PostGIS Database with GeoServer.

This Article Describes:
- Install GeoServer with Docker
- Connect the PostGIS Database to GeoServer
- Publish the Data
- View Published Data

Install GeoServer with Docker

1. Use the command below to pull the GeoServer image.

docker pull docker.osgeo.org/geoserver:2.25.x

2. Use the command below to run the GeoServer image.

docker run -d -p8080:8080 docker.osgeo.org/geoserver:2.25.x

3. In a web browser, navigate to http://localhost:8080/geoserver. If you see the GeoServer Welcome page, then GeoServer is successfully installed.

GeoServer installation

Connect the PostGIS Database to GeoServer

  1. Login to the GeoServer on the web browser.
    Username : admin
    Password : geoserver

2. On the Left menu click on “Workspaces” and then click “Add New Workspaces”.

3. Define your Name and Namespace URI. In this article, I define it as “Dev” then click “Save”.

4. On the Left menu click “Store”.

5. Click “Add New Store”.

6. Click “PostGIS”.

7. Set up your “Basic Store Info” and “Connection Parameters”, then click “Save”.
- In “Basic Store Info”, choose the workspace and define Data Source Name.
- In “Connection Parameters”, insert the data in the blank.

Publish the Data

1. Click “Layers” and then click “Add a new layer”.

2. Choose your workspace. In this article, it is “dev:postgis”.

3. Choose the table that you want to publish the data and then click “Publish”.

4. Fill the blanks in “Basic Resource Info”.

5. Fill the blanks in “Bounding Boxes”.
- In native bounding box click “Compute from data”.
- In Lat/Lon Bounding Box click “Compute from native bounds”.

6. Click the “Tile Caching” tab and pick the “Tile Image Formats” and click “Save”.

View Published Data

  1. Click “Layer Preview” choose “OpenLayers” for the row that you want to view the data.

The example of the Manhanttan (NY) landmarks:

Reference

--

--