The Malaysian CRS monster

HOME In Malaysia we prefer to use our national coordinate reference system (CRS) for scientific purposes, rather than the international UTM standard. A UTM zone boundary splits the Malay Peninsula in two, and another boundary bisects Malaysian Borneo. We encountered multiple problems using the Malaysian CRS with QGIS and R software, problems which Mikael Rittri attributed to the "Malayan Monster" back in 2011. Some solutions are described here.

The issues affect the following coordinate reference systems (CRSs):

  • Kertau (RSO) / RSO Malaya (m) (EPSG code 3168) used in the Malay Peninsula;
  • Timbalai 1948 / RSO Borneo (m) (EPSG 29873) used in Malaysian Borneo;
  • GDM2000 / Peninsula RSO (EPSG 3375), the new standard for the Peninsula;
  • GDM2000 / East Malaysia BRSO (EPSG 3376), the new standard for Borneo;

though I will only deal in detail with the first of these.

1. Beware of the impostor:

ArcGIS has a CRS called Kertau RSO Malaya (m) as well as one called Kertau (RSO) RSO Malaya (m). I hope you spotted the difference! Very similar names for two different things. The second one ("(RSO) RSO") conforms to EPSG 3168. The first one does not: it has a different datum, a different ellipsoid, a different azimuth, and a different false easting; it doesn't conform to anything. (Thanks to Chee Pheng and the folks at WCS Malaysia for checking on this.)

If you are using ArcGIS, be really careful which of these you are using: look for (RSO) RSO in the name. You can check a shapefile by opening the *.prj file in a text editor (eg, Notepad) and looking at the start of the WKT:

  • PROJCS["Kertau_RSO_RSO_Malaya",... good.
  • PROJCS["Kertau_RSO_Malaya_Meters"... bad!

2. Two names, one projection

Here the issue is two very different names but referring to the same thing. The Rectified Skew Orthomorphic (RSO) projection is the same as the Hotine Oblique Mercator projection.

In 1569 Geraldus Mercator published his map of the world, wrapping his flat map around the globe so that it touched along the equator; distortion is minimal at the equator but increases as you move away to the north or south. Wrapping the globe with the paper touching along a north-south meridian is a better solution if you live far from the equator: centre your map on the meridian of your choice, producing a Transverse Mercator map. If the area you are mapping doesn't run north-south, you can use any great circle as your centre line, resulting in an Oblique Mercator projection. First used for Switzerland, the Oblique Mercator projection was adapted for Malaysia in the 1940s by Martin Hotine, hence the name "Hotine Oblique Mercator". But Hotine himself named it "Rectified Skew Orthomorphic (RSO)", the term still generally used in Malaysia. See EPSG Guidance Note 7-2.

The two names are a problem when the projection details are written in Well-Known Text (WKT) format for shapefiles. ArcGIS uses the RSO name, QGIS and R, Hotine Oblique Mercator. The name included in the shapefile from one program is not recognised by another program.

3. The Case of the Missing Gamma

To use the Oblique Mercator projection, you need to specify the latitude and longitude of the centre of the map and the angle of the centre line at the map centre; this is the Azimuth in WKT, +alpha in proj4 notation.

Points are then mapped onto a u-v grid, with u being the distance along the centre line and v the distance from the centre line. In most cases, u = 0 corresponds to the map centre, but Hotine chose to set u = 0 at the point where the centre line crosses the equator, as this simplifies the calculations; this is indicated in WKT by adding _Natural_Origin to the projection name and in proj4 with +no_uoff.

The coordinates on the u-v grid must then be rotated to give the usual x-y grid (this is the "Rectify" bit in RSO). If u = 0 is the map centre, the rotation required is given by the Azimuth. But if u = 0 is at the equator, the rotation is not the same, and needs to be specified: this is "XY_Plane_Rotation" or "rectified_grid_angle" in WKT, +gamma in proj4 lingo. The difference between +alpha and +gamma is only 0.1 degrees, but that corresponds to an error of more than 1 km over the length of the Malay Peninsula.

When QGIS and R save shapefiles, the *.prj file does not specify "XY_Plane_Rotation" or "rectified_grid_angle".

However, QGIS saves an extra *.qpj file to the same location as the *.shp file, and this does have the correct parameters and the EPSG codes. When QGIS opens a shapefile it uses the *.qpj file instead of *.prj, so it reads correctly.

When a shapefile is opened in R with rgdal::readOGR, it looks at the *.prj file, and +gamma is simply missing, whether the shapefile comes from QGIS or ArcGIS. If the *.prj file is removed and the *.qpj file renamed to *.prj, +gamma is read correctly.

Since +gamma is only relevant for Malaysian projections, the oversight is understandable (if not forgivable).

So what to do?

Stop using shapefiles!

Use either the GeoPackage format (if you are using QGIS or R) or Geodatabase (for ArcGIS). ArcGIS 10.2.2 or later, QGIS 2.12.2 or later, and recent version of rgdal can read both GeoPackage and Geodatabase input, and the proper CRS parameters are correctly written and read.

Stop using the Kertau RSO Malaya CRS in ArcGIS!

And convert any existing files you have that use it to the proper Kertau (RSO) RSO Malaya CRS. I'm not an ArcGIS user, but it should be possible to write a Python script and do this as a batch job.

Don't manually assign a CRS to an unknown shapefile!

I fear that a lot of trouble has been caused by folks reading a shapefile using Kertau RSO Malaya into QGIS or R, and manually assigning EPSG 3168. This is incorrect, but will be used when the data are saved again. How many shapefiles on your system have gone through this process?

It may still be necessary to manually assign a CRS, but make sure you know what the correct CRS is.


Hat tip: Thanks to Fen and Chee Pheng for information and checking.

Updated 26 March 2018 by Mike Meredith