2

I have a number of .shp's that I have converted from EPSG 4148 to CPNO27. Some have come out perfectly and others revert to EPSG 1000007. I have checked and the only difference between the two is the addition of the bold text in CPO27 Cape/27.

As far as I understand, to save a file in a re-projection, one right clicks >> save as >> insert name >> ensure the EPSG is appropriately selected. So why would some of my .shp's revert to the 100007 EPSG (automatically might I add!!!) and not in CPNO27?

I have even gone as far as testing each file by setting CRS of .shop individually and if it changes spatial location, then doing a re-export, always selecting the CRS.

EPSG's follow:

1000007

+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=0 +y_0=0 +a=6378249.145 +b=6356514.966398753 +towgs84=-136,-108,-292,0,0,0,0 +units=m +no_defs

Cape/27

+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=0 +y_0=0 +axis=enu +a=6378249.145 +b=6356514.966398753 +towgs84=-136,-108,-292,0,0,0,0 +units=m +no_defs
  • I have just checked and no matter how many times i save the file, sometimes the EPSG just 'dissapears'. e.g. in sum lne lengths, instead of "EPSG:4328" i will have "[]". i can right click and assign CRS or assign CRS in the properties under the general tab, (and even export thereafter) it still loses the EPSG. – VeM Mar 20 '14 at 16:49
  • A hack would be to overwrite the content of the broken .prj files with the content of correct .prj files. – underdark Mar 20 '14 at 19:02
3

CPNO27 is not an official EPSG code, reference ID in QGIS 2.2 is ZANGI:ZANGI:CPNO27. The official one is EPSG:22287 Cape/Lo27

The difference is the axis orientation: CPNO21 has +axis=enu (which is default and can be omitted), while Cape/Lo27 has +axis=wsu.

Usually, .prj files do not deal with the EPSG codes, but use the full WKT parameters. QGIS has to guess the EPSG codes from them, and sometimes fails and creates a custom CRS from it.

You can override wrong guesses with rightclick -> Set CRS for layer.

QGIS additionally creates a .qpj file where the EPSG code is stored. If you exchange that, next time QGIS will come up with the right CRS. Unfortunately, this does not work as expected for non-EPSG codes.

Here is the CPNO27 .prj file:

PROJCS["Transverse_Mercator",
  GEOGCS["GCS_unnamed ellipse",
  DATUM["D_unknown",
  SPHEROID["Unknown",6378249.145,293.4663076999908]],
  PRIMEM["Greenwich",0],
  UNIT["Degree",0.017453292519943295]],
PROJECTION["Transverse_Mercator"],
  PARAMETER["latitude_of_origin",0],
  PARAMETER["central_meridian",27],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["Meter",1]]

and the .qpj file:

PROJCS["unnamed",
  GEOGCS["unnamed ellipse",
  DATUM["unknown",
  SPHEROID["unnamed",6378249.145,293.4663076999908],
  TOWGS84[-136,-108,-292,0,0,0,0]],
  PRIMEM["Greenwich",0],
  UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
  PARAMETER["latitude_of_origin",0],
  PARAMETER["central_meridian",27],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["Meter",1]]

For the official EPSG:22287 code, the qpj reads:

PROJCS["Cape / Lo27",
  GEOGCS["Cape",
  DATUM["Cape",
  SPHEROID["Clarke 1880 (Arc)",6378249.145,293.4663077,
    AUTHORITY["EPSG","7013"]],
  TOWGS84[-136,-108,-292,0,0,0,0],
    AUTHORITY["EPSG","6222"]],
  PRIMEM["Greenwich",0,
    AUTHORITY["EPSG","8901"]],
  UNIT["degree",0.0174532925199433,
    AUTHORITY["EPSG","9122"]],
  AUTHORITY["EPSG","4222"]],
PROJECTION["Transverse_Mercator_South_Orientated"],
  PARAMETER["latitude_of_origin",0],
  PARAMETER["central_meridian",27],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["metre",1,
    AUTHORITY["EPSG","9001"]],
  AXIS["Y",WEST],
  AXIS["X",SOUTH],
  AUTHORITY["EPSG","22287"]]

OK, let's manipulate the last one to meet CPNO27:

PROJCS["South African CRS : Cape_NO_27",
  GEOGCS["Cape",
  DATUM["Cape",
  SPHEROID["Clarke 1880 (Arc)",6378249.145,293.4663077,
    AUTHORITY["EPSG","7013"]],
  TOWGS84[-136,-108,-292,0,0,0,0],
    AUTHORITY["EPSG","6222"]],
  PRIMEM["Greenwich",0,
    AUTHORITY["EPSG","8901"]],
  UNIT["degree",0.0174532925199433,
    AUTHORITY["EPSG","9122"]],
  AUTHORITY["EPSG","4222"]],
PROJECTION["Transverse_Mercator"],
  PARAMETER["latitude_of_origin",0],
  PARAMETER["central_meridian",27],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["metre",1,
    AUTHORITY["EPSG","9001"]],
  AXIS["X",EAST],
  AXIS["Y",NORTH],
  AUTHORITY["ZANGI:ZANGI","CPNO27"]]

This seems to work for me when adding new files to the QGIS project. Old layers may still have the custom CRS stored inside the .qgs project file.

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.