Basics 4: Publishing Map Services
Learn how to expose your geospatial data using standard web services like WMS, WFS, and WCS. This is the core of GeoServer's power.
Now that you have data loaded and styled (covered in Basics 2 & 3), it's time to publish your data. Publishing creates a web service endpoint that applications, dashboards, and other users can consume to view and interact with your maps.
GeoServer implements several Open Geospatial Consortium (OGC) standards. In this guide, we focus on the most common ones:
- WMS (Web Map Service): Serves rendered map images (PNG, JPEG). Best for fast display of complex maps.
- WFS (Web Feature Service): Serves raw vector features (GeoJSON, GML). Best for editing, analysis, and interactive client-side rendering.
- WCS (Web Coverage Service): Serves raw raster data. Best for scientific analysis of raster grids.
How Publishing Works
Unlike other servers, GeoServer doesn't require a manual "Publish" button for every layer. By default, all data in your workspaces is immediately available via WMS and WFS as soon as it is added.
Because data is published automatically, ensure you have configured Security Roles (covered in Basics 5) if your data contains sensitive information.
Step 1: Verify Your Layer is Published
- Navigate to
/web/data/layers/in the GeoServer Web UI. - Locate your layer in the list.
- Ensure the Enabled checkbox is ticked.
- Click Save at the bottom of the page.
If enabled, your layer is now live at the standard WMS/WFS endpoints.
Step 2: Constructing Service URLs
You can access your services by constructing URLs. GeoServer provides a demo module that helps test these, but direct URLs look like this:
WMS GetMap Request
Request a map image for a specific bounding box.
http://localhost:8080/geoserver/workspaces/ows? SERVICE=WMS &VERSION=1.1.1 &REQUEST=GetMap &LAYERS=workspaces:my_layer &STYLES= &BBOX=-180,-90,180,90 &WIDTH=800 &HEIGHT=600 &FORMAT=image/png
WFS GetFeature Request
Request raw vector data in GeoJSON format.
http://localhost:8080/geoserver/workspaces/wfs? SERVICE=WFS &VERSION=2.0.0 &REQUEST=GetFeature &TYPENAMES=workspaces:my_layer &OUTPUTFORMAT=application/json
Enable the "Demo" module in GeoServer to get an interactive form that builds these URLs for you automatically.
Step 3: Configuring WMS Layer Details
You can customize how a layer behaves when requested via WMS. Go to /web/data/layers/ and click your layer name.
- Title & Abstract: Metadata displayed in GetCapabilities documents.
- Lat/Long Bounding Box: Helps clients position your layer correctly if no coordinate system is defined.
- Max Features: Limit the number of features returned to prevent slow responses.
- CQL Filter: Apply a default SQL-like filter to the service (e.g.,
"population" > 10000).
Step 4: Testing in an External Client
The best way to verify your service is to load it into a GIS client like QGIS, Leaflet, or OpenLayers.
QGIS Example
- Open QGIS.
- Go to
Layer>Add Layer>Add WMS/WMTS Layer. - Click New and name it "GeoServer".
- Enter URL:
http://localhost:8080/geoserver/workspaces/wms. - Click Connect. Your layers should appear in the list.
- Check your layer and click Add.
Leaflet Example (JavaScript)
Here's a minimal snippet to add your WMS layer to a Leaflet map:
var map = L.map('map').setView([0, 0], 2);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap'
}).addTo(map);
L.tileLayer.wms('http://localhost:8080/geoserver/workspaces/wms', {
layers: 'workspaces:my_layer',
format: 'image/png',
transparent: true,
attribution: 'GeoServer'
}).addTo(map);
Troubleshooting
- 403 Forbidden: Check security settings. Ensure "Anonymous" has read access.
- Layer not found: Verify the workspace and layer name in the URL.
- Blank Map: Check the bounding box and coordinate reference system (CRS) match your data.
Next Steps
Now that your data is published, you need to secure it. In the next chapter, we'll cover Security & Access Control, including role-based permissions, authentication providers, and fine-tuning service-level security.