Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active July 27, 2016 20:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ThomasG77/8490159 to your computer and use it in GitHub Desktop.
Proj4js conversion using Lambert 93 and the new proj4js API (v2.x)Open your JavaScript console to see the result
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>proj4js v2 example </title>
</head>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.2/proj4.js" type="text/javascript"></script>
<script src="//epsg.io/2154.js" type="text/javascript"></script>
<script>
var epsg2154 = proj4('EPSG:2154');
console.log(proj4('EPSG:4326', epsg2154, [-1.5603, 47.2383]));
console.log(proj4(epsg2154,[-1.5603, 47.2383]));
console.log(proj4('EPSG:4326',epsg2154).forward([-1.5603, 47.2383]));
console.log(proj4(epsg2154,'EPSG:4326').inverse([-1.5603, 47.2383]));
console.log(proj4(epsg2154).forward([-1.5603, 47.2383]));
console.log(proj4(epsg2154).inverse([355199.18362550647, 6691959.121707187]));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment