Consuming Custom Projections in QGIS from GeoServer and PostGIS
When working with specialized local grids or historical maps in Geographic Information Systems (GIS), standard EPSG codes often fall short. To prevent your data from "floating" in the wrong hemisphere when loaded into QGIS via WFS or WMS, you must implement a unified CRS strategy across your database, your application server, and your desktop client.
1. Phase One: The Database (PostGIS)
PostgreSQL stores its projection knowledge in a table called spatial_ref_sys. For a custom projection to be recognized, you must insert your definition (WKT or Proj4 string) into this table using a unique SRID (typically in the 900,000 range to avoid future EPSG conflicts).
-- Example: Inserting a custom projection with SRID 900001
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)
VALUES (900001, 'CUSTOM', 900001,
'PROJCS["My_Local_Grid", ... ]',
'+proj=tmerc ...');
2. Phase Two: The Middleware (GeoServer)
GeoServer acts as the translator. Even if PostGIS knows the CRS, GeoServer must be told how to serve it to web clients like QGIS. If not configured, GeoServer will often default custom SRIDs to USER:100000, which QGIS may not recognize.
- Navigate to your GeoServer Data Directory:
user_projections/. - Open (or create)
epsg.properties. - Add your definition:
900001=PROJCS["My_Local_Grid", ... ] - In the GeoServer Web UI, go to the Layer Settings and ensure Declared CRS is set to your custom code.
3. Phase Three: The Client (QGIS)
When QGIS requests a WFS or WMS layer, it looks for the AUTHORITY:CODE string. If QGIS doesn't have a matching definition in its local "User Defined CRS" library, it will treat the incoming coordinates as raw numbers.
- Automatic Recognition: If your WFS/WMS response includes the full WKT, QGIS 3.x+ is often smart enough to generate a temporary CRS.
- Manual Sync: To be safe, go to
Settings > Custom Projectionsand add the same WKT string used in PostGIS. Name it exactly as it appears in your GeoServer metadata.
4. Troubleshooting Sync Errors
| Symptom | Likely Culprit | Resolution |
|---|---|---|
| Layer shifted by ~100m | Datum Transformation mismatch. | Check TOWGS84 parameters in your WKT across all systems. |
| Layer doesn't appear | Axis Order (XY vs YX). | In QGIS WFS Connection settings, toggle "Ignore axis orientation." |
| Error: NoSuchAuthorityCode | GeoServer epsg.properties. |
Restart GeoServer or hit the "Reset" button in Server Status. |
Conclusion
Consuming a custom projection from a PostGIS/GeoServer stack into QGIS requires a "Three-Point Check." By ensuring the SRID and WKT definition are identical in the spatial_ref_sys table, the GeoServer epsg.properties file, and the QGIS Custom CRS settings, you eliminate the ambiguity that causes projection drift. In 2026, using WKT (Well-Known Text) over Proj4 strings is highly recommended for better precision and cross-platform compatibility.
Keywords
QGIS custom CRS GeoServer, PostGIS spatial_ref_sys custom projection, WFS custom coordinate system error, GeoServer epsg.properties tutorial 2026, SRID 900001 QGIS, custom WKT projection GIS, web mapping coordinate mismatch fix.
