4

I am trying to transform a geometry to the EPSG:4978 projection. As the EPSG:4978 was missing in the spatial_ref_sys table, I have added it using the following query:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 4978, 'epsg', 4978, '', 'GEOCCS["WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["m",1.0],AXIS["Geocentric X",OTHER],AXIS["Geocentric Y",EAST],AXIS["Geocentric Z",NORTH],AUTHORITY["EPSG","4978"]]');

Source: http://spatialreference.org/ref/epsg/wgs-84-2/postgis/

When I however try to use the projection in one of my queries, it fails with:

ERROR: AddToPROJ4SRSCache: could not parse proj4 string ''

With Proj4js the empty string definition works just fine, so it seems to me that Postgis should handle the empty string case as well. Or am I misunderstanding something specifically about EPSG:4978? What is the proper way to transform a coordinate to EPSG:4978?

5

Looks like there is an error in the statement at the link you provided, with the SRID being 94978, it should be:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 4978, 'epsg', 4978, '', 'GEOCCS["WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["m",1.0],AXIS["Geocentric X",OTHER],AXIS["Geocentric Y",EAST],AXIS["Geocentric Z",NORTH],AUTHORITY["EPSG","4978"]]');

My PostGIS version 2.2.2 rl14797 has the following data for 4978:

srid = 4978

auth_name = "EPSG"

proj4text = "+proj=geocent +datum=WGS84 +units=m +no_defs "

srtext = "GEOCCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Geocentric X",OTHER],AXIS["Geocentric Y",OTHER],AXIS["Geocentric Z",NORTH],AUTHORITY["EPSG","4978"]]"

  • gdalsrsinfo epsg:4978 outputs the same strings, at least for GDAL 2.1.0 – AndreJ Jun 30 '16 at 15:32
  • I also noticed the strange SRID value for the provided query.... That's why I already changed the value. Will try again with your proj4 definition. – Jan-Willem Gmelig Meyling Jun 30 '16 at 15:44
  • the srtext I have is also a bit different but probably wont affect anything because the spheroid is the same – kttii Jun 30 '16 at 15:50

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.