Advertisement
Guest User

Proj4 transform test

a guest
May 31st, 2014
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var proj4 = require('proj4');
  2.  
  3. var source = new proj4.Proj('EPSG:4326');    //source coordinates will be in Longitude/Latitude, WGS84
  4. var dest = new proj4.Proj("+proj=utm +zone=33 +ellps=intl +units=m +no_defs"); // see http://spatialreference.org/ref/epsg/2078/
  5. var p = new proj4.Point(10.68772, 59.4214);   //any object will do as long as it has 'x' and 'y' properties
  6. proj4.transform(proj4.WGS84, dest, p);      //do the transformation.  x and y are modified in place
  7.  
  8. console.log(p);
  9.  
  10.  
  11. /** Which will give the following output: */
  12. { x: 255387.99669727485,
  13.   y: 6595140.362325359,
  14.   z: -183.33591040596366 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement