I have data in a postgresql data store in EPSG:2163 and am displaying that using OpenLayers in EPSG:3857. This results in a ~25 km northerly shift when displayed either in QGIS or OpenLayers.

To test the reprojection I used GDAL and the Geoserver reprojection console, which confirmed that the x-coordinates were reprojecting correctly but the y-coordinates were artificially high.

GDAL: gdaltransform -s_srs EPSG:2163 -t_srs EPSG:3857 1494718.24465831 -1025289.47657808

output = -9310869.18028598 4090931.77295946 0 (this displays correctly).

Geoserver: Reprojection Console

output =-9310869.180285975 4115158.942481106 (this displays north of expected).

Resulting in a difference of 24.2 km.

It seems to me that this a projection problem within Geoserver, any ideas what the problem is or how I can get around this? If I reproject my source data in postgresql to EPSG:3857, there are no projection problems but I want to keep my source data in EPSG:2163.

  • I noticed that there is a difference in the coordinate system definition for EPSG:3857 between GDAL and Geoserver. GS = UNIT["degree", 0.017453292519943295] and GDAL = UNIT["degree",0.0174532925199433, though it seems like a very slight rounding difference. – akthor Apr 19 '14 at 17:24

An offset of about 20 km to the North is usual between the ellipsoidal and the special Google spherical version of Mercator. I guess that recent versions of GDAL do it right.

Feel free to make a bug report at Geoserver.

In the meantime, avoid EPSG:3857 if possible, or do the reprojection inside Postgis or GDAL.

  • Thanks, I ended up creating views for my layers in postgres and reprojecting the geometry column to 3857. Then I publish the view instead of the table. Something like this:CREATE OR REPLACE VIEW [VIEW_NAME] AS SELECT st_transform(geometry, 3857) AS geometry, [FIELD_1], [FIELD_N] FROM [TABLE_NAME]; – akthor Apr 20 '14 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.