[Geoserver-users] postgis and geoserver projecting differently

In trying to troubleshoot why the same data as a geoserver wms and postgis vector were shifted relative to one another, I picked up that they are projecting differently (26331 to 3875):

input point example:

"SRID=26331;POINT(542053.551 787930.307)"

in postgis (2.0):

"SRID=3857;POINT(376265.240380565 795675.534596811)"

in geoserver (2.2-SNAPSHOT):

"SRID=3857;POINT(376271.1415793335 790368.2841989407)"

proj4 text that postgis uses:

  +proj=utm +zone=31 +ellps=clrk80 +towgs84=-92,-93,122,0,0,0,0 +units=m +no_defs

The WKT parameters that geoserver users:

I can't find them...I tried to follow these instructions http://docs.geoserver.org/latest/en/user/advanced/crshandling/manualepsg.html but they appear to be out of date since instead of EPSG.sql there is now EPSG.zip containing EPSG.script, EPSG.properties and EPSG.data. The latter which probably contains the projection definitions is binary.

postgis WKT for comparison:

  PROJCS["Minna / UTM zone 31N",GEOGCS["Minna",DATUM["Minna",SPHEROID["Clarke 1880 (RGS)",6378249.145,293.465,AUTHORITY["EPSG","7012"]],TOWGS84[-92,-93,122,0,0,0,0],
AUTHORITY["EPSG","6263"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4263"]],
UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",3],
PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],AUTHORITY["EPSG","26331"],AXIS["Easting",
EAST],AXIS["Northing",NORTH]]

Any ideas which definition or transformation engine might be wrong?

--
regards

Gavin

Gavin Fleming
http://afrispatial.co.za
t: 0218630660
c: 0845965680
f: 0866164820

Dear Gavin,

the problem is probably the difference of the datum shift parameters between
PostGIS and GeoServer transformations.

if this is the case, then look at this:
http://docs.geoserver.org/stable/en/user/advanced/crshandling/customcrs.html

you can override the built-in epsg parameters in Geoserver by creating the
epsg_overrides.properties file, and placing the WKT form of the PostGIS
parameters. Read carefully the instructions, you will also have to remove the
"authority" information as it says.

I hope it will help.

GEDE Mátyás
ELTE Térképtudományi és Geoinformatikai Tanszék, Budapest

On Fri, 15 Feb 2013 17:58:20 +0200, Gavin Fleming wrote

In trying to troubleshoot why the same data as a geoserver wms and
postgis vector were shifted relative to one another, I picked up
that they are projecting differently (26331 to 3875):

input point example:

"SRID=26331;POINT(542053.551 787930.307)"

in postgis (2.0):

"SRID=3857;POINT(376265.240380565 795675.534596811)"

in geoserver (2.2-SNAPSHOT):

"SRID=3857;POINT(376271.1415793335 790368.2841989407)"

proj4 text that postgis uses:

  +proj=utm +zone=31 +ellps=clrk80 +towgs84=-92,-93,122,0,0,0,0
+units=m +no_defs

The WKT parameters that geoserver users:

I can't find them...I tried to follow these instructions

http://docs.geoserver.org/latest/en/user/advanced/crshandling/manualepsg.html
but they appear to be out of date since instead of EPSG.sql there is now
EPSG.zip containing EPSG.script, EPSG.properties and EPSG.data. The latter
which probably contains the projection definitions is binary.

postgis WKT for comparison:

  PROJCS["Minna / UTM zone
31N",GEOGCS["Minna",DATUM["Minna",SPHEROID["Clarke 1880

(RGS)",6378249.145,293.465,AUTHORITY["EPSG","7012"]],TOWGS84[-92,-93,
122,0,0,0,0], AUTHORITY["EPSG","6263"]],PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4263"]], UNIT["metre",1,
AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",3],
PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],AUTHORITY["EPSG","26331"],
AXIS["Easting", EAST],AXIS["Northing",NORTH]]

Any ideas which definition or transformation engine might be wrong?

--
regards

Gavin

Gavin Fleming
http://afrispatial.co.za
t: 0218630660
c: 0845965680
f: 0866164820

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

GEDE Mátyás
ELTE Térképtudományi és Geoinformatikai Tanszék, Budapest

On Fri, Feb 15, 2013 at 6:02 PM, Gede Mátyás <saman@anonymised.com> wrote:

Dear Gavin,

the problem is probably the difference of the datum shift parameters between
PostGIS and GeoServer transformations.

The TOWGS84 parameters GeoServer is picking from the official EPSG database are indeed
quite different, evething else seems pretty much the same:

PROJCS["Minna / UTM zone 31N", 
  GEOGCS["Minna", 
    DATUM["Minna", 
      SPHEROID["Clarke 1880 (RGS)", 6378249.145, 293.465, AUTHORITY["EPSG","7012"]], 
      TOWGS84[-111.92, -87.85, 114.5, 1.875, 0.202, 0.219, 0.032], 
      AUTHORITY["EPSG","6263"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic longitude", EAST], 
    AXIS["Geodetic latitude", NORTH], 
    AUTHORITY["EPSG","4263"]], 
  PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], 
  PARAMETER["central_meridian", 3.0], 
  PARAMETER["latitude_of_origin", 0.0], 
  PARAMETER["scale_factor", 0.9996], 
  PARAMETER["false_easting", 500000.0], 
  PARAMETER["false_northing", 0.0], 
  UNIT["m", 1.0], 
  AXIS["Easting", EAST], 
  AXIS["Northing", NORTH], 
  AUTHORITY["EPSG","26331"]]

Still… 5km offset along the north axis seems like a lot

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it