Skip to content

Instantly share code, notes, and snippets.

@keehyun2
Last active November 24, 2020 06:47
Show Gist options
  • Save keehyun2/13b12f8831e3b2b9b9bcc3d904340436 to your computer and use it in GitHub Desktop.
Save keehyun2/13b12f8831e3b2b9b9bcc3d904340436 to your computer and use it in GitHub Desktop.
https://www.data.go.kr/ 에서 제공하는 utm-k 를 wgs84 로 변경하는 방법
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Road API</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.6.2/proj4.js" integrity="sha512-cgJnZ1VX2G0MAN4C5OGShwI3zHhfQ6RLriXuukhblNu+T082/ZRGoWLP/0xMKObvB6AUKdnm27hQKj8hKZPjXA==" crossorigin="anonymous"></script>
<script>
// https://www.data.go.kr/ 에서 제공하는 utm-k 를 wgs84 로 변경하는 방법
/**
* utm-k 좌표 체계를 wgs84 좌표 체계로 전환
* 사용법 ex) {x: 957973.8914175825, y: 1956710.0614834363}
*/
function UTMK_TO_WGS84(coord){
var projection = "+proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=GRS80 +units=m +no_defs";
var result = proj4(projection).inverse([coord.x, coord.y]);
return {"lat" : result[1], "lon" : result[0]};
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment