Skip to content

Instantly share code, notes, and snippets.

@debuggingfuture
Last active August 29, 2015 14:22
Show Gist options
  • Save debuggingfuture/b63fbdf5249e249c5165 to your computer and use it in GitHub Desktop.
Save debuggingfuture/b63fbdf5249e249c5165 to your computer and use it in GitHub Desktop.
Converting HK1980Grid (EPSG:2326) into WGS84
var proj4 = require('proj4');
//https://github.com/proj4js/proj4js
//More on the systems
//http://www.geodetic.gov.hk/data/pdf/explanatorynotes.pdf
proj4.defs('WGS84', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
//HK co-ordinate system http://spatialreference.org/ref/epsg/hong-kong-1980-grid-system/
proj4.defs('EPSG2326','+proj=tmerc +lat_0=22.31213333333334 +lon_0=114.1785555555556 +k=1 +x_0=836694.05 +y_0=819069.8 +ellps=intl +towgs84=-162.619,-276.959,-161.764,0.067753,-2.24365,-1.15883,-1.09425 +units=m +no_defs');
//convert co-ordinates from HK 1980 to WGS84
var coordinatesWGS84 = proj4('EPSG2326','WGS84',[832699,836055]);
console.log(coordinatesWGS84);
//[ 114.14219797067243, 22.46398393930019 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment