Thursday, 5 March 2015

postgis - Help defining custom CRS in QGIS 2.2


I'm trying to use EPSG:4479 in QGIS.


1) If I search for EPSG:4479, it returns a "Imported from GDAL" EPSG:4479, but it does not work. At the console, the following message is displayed:


ERROR 6: EPSG PCS/GCS code 4479 not found in EPSG support files.  Is this a valid

EPSG coordinate system?

It should not be a problem, because I can always add a new CRS. But...


2) I tried to define a new CRS in QGIS 2.2, without success.


I go to Settings -> Custom CRS... and fill the new CRS with: Name: China Geodetic Coordinate System 2000 Parameters: +proj=geocent +ellps=GRS80 +units=m +no_defs


Custom CRS definition


These parameters are copy and pasted from EPSG:4479.


I can use the calculator at the botton to test the coordinate transformation, and it works.


But when I try to save the new CRS, it complains with the message: The proj4 definition is not valid.


Error reporting invalid proj4 definition



What am I doing wrong?


There is a quite similar question around, but not answered. But I'm not using a custom proj4 library.


I'm using QGIS 2.2, PROJ.4 Version 470, on top of the OSGeo Live 7.9.


The same proj4 string works in PostGIS. I am able to do:


INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 4479, 'EPSG', 4479, '+proj=geocent +ellps=GRS80 +units=m +no_defs ', 'GEOCCS["China Geodetic Coordinate System 2000",DATUM["China_2000",SPHEROID["CGCS2000",6378137,298.257222101,AUTHORITY["EPSG","1024"]],AUTHORITY["EPSG","1043"]],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","4479"]]');

select ST_AsText(ST_Transform(ST_SetSRID(ST_Makepoint(114,30), 4326), 4479));

It returns the expected result:


"POINT(-2248544.5475367 5050313.74152924)"


Answer



I have no problem saving the outline of China in EPSG:4479, and setting the project CRS to that:


enter image description here


Since this is a geocentric CRS, you really need all three coordinates, while QGIS usually works 2-dimensional. That might be a reason why some operations may fail.


The geocent projection is not listed by proj -lp in a terminal window, but proj is able to convert the coordinates, while the inverse conversion returns wrong values. cs2cs does it both ways.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...