Skip to content

Instantly share code, notes, and snippets.

@Firefishy
Forked from gubuntu/SACRS.md
Created September 7, 2016 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Firefishy/4dea27b6624b2be6067dd8856bb38abe to your computer and use it in GitHub Desktop.
Save Firefishy/4dea27b6624b2be6067dd8856bb38abe to your computer and use it in GitHub Desktop.
southern African coordinate reference systems (CRS) definitions in proj4 and WKT

Use this file to get the CRS definitions you need in southern Africa, particularly South Africa, Lesotho, Swaziland and Zimbabwe.

Most GIS software now implements the South African CRS (SACRS; incorrectly but popularly known as the "LO" system) which is based on south-oriented (or south-facing) transverse mercator (TMSO). The EPSG codes for these are:

  • odd numbers from 22275 to 22293 for the Cape datum
  • all numbers from 2046 to 2055 for the Hartebeesthoek94 or WGS84 datum.

If you have data in one of these south-oriented CRSs it will draw upside down and back to front in its native CRS but if you have on-the-fly transformation enabled, your layers will overlay your other data perfectly in whatever project CRS you choose. This feature request will result south-oriented coordinates and visualisation being more intutitive to GIS users.

Note on datums: Although there are a few metres difference between the WGS84 and Hartebeethoek94 datums, for all intents and purposes in the GIS world they can be considered the same - indeed the EPSG does not prescribe a datum transformation between the two. Also, if you need to transform from the Cape datum to Hartebeesthoek94, do NOT do it in your GIS. Your GIS software will apply a blanket transformation which will have large errors. You need instead to use specialist software and GCP points to locally transform your data because the error in the Cape datum varies hugely across the country.

You'll get south-oriented coordinates from land surveyors or CAD exports, but in practice most GIS practitioners use north-oriented transverse mercator. So, here are some definitions you can use for north-oriented TM, which I'll call "SACRS_NO" as well as some for Albers and other CRS guidelines for southern Africa. I blogged more about this a while back with "LO 19" as an example at http://afrispatial.co.za/foss-gis/south-african-projections-in-foss-gis/. There are no EPSG codes for any north-oriented CRSs for South Africa, so you have to roll your own in most software, but we (Tim Sutton and I) added these to QGIS for the launch of v2.0 in 2013 for your convenience. This is what the acronyms mean: ZANGI (ZA [South Africa] National Geospatial Information); HBK (Hartebeesthoek94); NO (north-oriented):

  • Cape datum: South African CRS : CAPE_NO_15 or ZANGI:CPNO15 (substitute any central meridian from 15 to 33)
  • Hartebeesthoek94 datum: South African CRS : HBK_NO_15 or ZANGI:HBKNO15 (substitute any central meridian from 15 to 33)

SACRS North-Oriented CRS on Hartebeesthoek94 or WGS84 datum

(These are the normal TM CRS you would use in everyday GIS)

If you are working in an area up to 1 degree either side of the central meridian, this is the ideal CRS.

SACRS_NO_27 in proj4

+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=0 +y_0=0 +axis=enu +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

Note the +axis=enu, which denotes a north-oriented CRS.

In QGIS you can use one of the predefined CRSs listed above.

SACRS_NO_27 in WKT

(what you'd get in a .prj file, or the Geoserver epsg_properties file)

PROJCS["SACRS_NO_27",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563],TOWGS84[0,0,0,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]]

To get the other TM zones, just substitute 27 with the zone you want.

SACRS North Facing on Cape datum

(e.g. for old South African data or Lesotho data)

TM_Cape_NO_27 in proj4

+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

In QGIS you can use one of the predefined CRSs listed above.

TM_Cape_NO_27 in WKT

PROJCS["TM_Cape_NO_27",GEOGCS["GCS_Cape",DATUM["D_Cape",SPHEROID["Clarke_1880_Arc",6378249.145,293.4663077]],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]]

UTM

If you are working in an area up to six degrees wide that fits into one UTM zone, then use one of the predefined UTM zones on the appropriate datum.

e.g. UTM 34S on the WGS84 datum, which is EPSG:32734

Albers

If you are working in a larger area, then define your own Albers projection to suit. Here's an example appropriate for the whole of South Africa:

proj4

+proj=aea +lat_1=-24 +lat_2=-32 +lat_0=0 +lon_0=24 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs

WKT

PROJCS["Albers_SA",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers"],PARAMETER["standard_parallel_1",-24],PARAMETER["standard_parallel_2",-32],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",24],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]

Guidelines for the parameters when defining your own Albers CRS are that the central meridian should go through the centre of your area and the 1st and 2nd parallels should go one sixth down from the northern extent and one sixth up from the southern extent respectively.

Software implementation

QGIS

Go to Settings -> Custom CRS and add a new CRS with the appropriate proj4 definition.

PostGIS

Insert a record into spatial_ref_sys with your own unique srid and the appropriate matching proj4 and WKT (srtext) definition.

Geoserver

Add a line to <geoserver data dir>/user_projections/epsg.properties with your own unique code and a WKT definition.

These are mine for TM North facing for all the zones in SA:

40015=PROJCS["HBKNO15",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",15],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40015"]]]
40017=PROJCS["HBKNO17",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",17],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40017"]]]
40019=PROJCS["HBKNO19",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",19],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40019"]]]
40021=PROJCS["HBKNO21",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",21],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40021"]]]
40023=PROJCS["HBKNO23",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",23],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40023"]]]
40025=PROJCS["HBKNO25",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",25],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40025"]]]
40027=PROJCS["HBKNO27",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],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","40027"]]]
40029=PROJCS["HBKNO29",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",29],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40029"]]]
40031=PROJCS["HBKNO31",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",31],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40031"]]]
40033=PROJCS["HBKNO33",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","40033"]]]

GDAL/OGR/Proj4

Either use explicit proj4 code strings for CRS definitions that are not in the EPSG database or add them to your installation's EPSG database file which in Ubuntu is /usr/share/proj/epsg. Just give them unique IDs like the ones I used above for Geoserver.

ArcGIS

Define a new projection in ArcCatalog with the appropriate WKT definition.

Disclaimer: Use these at your own risk. This is a public gist - feel free to edit or comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment