Atlaslog / Field Notes / Loading & display
Field note · Loading & display
GeoServer declares 4326 data as 4490, layer shifts half a meter
Quick answer
The data is WGS84 but the layer's nativeCRS is set to EPSG:4490, so GeoServer treats them as different datums and applies a shift on every request. The boundary moves about 0.45 m west and fails a 1:1000 acceptance check.
Symptom
- The original .shp in QGIS matches the satellite basemap, but the WMS output shifts the boundary about 0.45 m west.
- GetFeature returns vertices differing from the source by about 0.0000045 degrees.
- On a 1:1000 planning map the boundary falls outside the red line and fails acceptance.
Checklist
- Open the layer edit page and compare Declared SRS with Native SRS.
- Fetch one known vertex with GetFeature and subtract the original file coordinate.
- A difference in the 1e-6~1e-5 degree range points to a datum shift, not a projection change.
- Switch SRS handling to FORCE_DECLARED or REPROJECT_TO_DECLARED and fetch again to see whether the difference disappears.
- Check that the PostGIS geometry SRID matches the declared layer CRS.
Fix
Set nativeCRS to what the data really is, 4326 for WGS84 and 4490 for CGCS2000, then choose FORCE_DECLARED when only the metadata was wrong and REPROJECT_TO_DECLARED when a real transformation is required.
Code
# 取一个顶点对比
curl "http://localhost:8080/geoserver/gis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=gis:districts&maxFeatures=1&outputFormat=application/json"
# 原始值 116.3974280, 39.9092300
# 返回值 116.3974235, 39.9092302
# 差 -4.5e-6 度,约 0.45 米PUT /rest/workspaces/gis/datastores/pg/featuretypes/districts
Content-Type: application/json
{
"featureType": {
"nativeCRS": "EPSG:4326",
"srs": "EPSG:4326",
"projectionPolicy": "FORCE_DECLARED"
}
}
Watch out
- Choosing REPROJECT_TO_DECLARED to 'fix' a mis-declared layer, which keeps applying a datum shift it does not need.
- Leaving nativeCRS wrong and correcting the output by nudging the bounding box or the style.
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Atlaslog (2026). GeoServer declares 4326 data as 4490, layer shifts half a meter. https://www.jingweizhi.com/en/cookbook/geoserver-srs-mismatch.html (accessed 2026-11-03).