new CoordManager()
다양한 좌표계 변환 및 지도 중심 이동 등 좌표계 관련 기능을 처리하는 클래스이다.
Methods
(static) DMS2Geo(lon, lat) → {string|object}
입력한 좌표값(경도, 위도)을 10진법으로(Degree) 변환한다.
Example
//입력형식 : 126°30′00″E
//입력형식 : 37°30′00″N
//60진법 도분초 좌표를 10진법 Degree 좌표값을 변환한다.
var result = window.CoordManager.DMS2Geo(lon, lat).split(',');
var lon = result[0];
var lat = result[1];
//'126.5', '37.5'
console.log(lon, lat);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 좌표값(126° 00′ 05.31″ E) |
lat |
number | 위도 좌표값(37° 28′ 40.12″ N) |
Returns:
10진법으로 환산된 좌표값 반환
- Type
- string | object
(static) GARS2Geo(gars) → {string}
입력한 GARS 좌표값을 위경도 좌표값으로 변환한다.
Example
var gars = '614LR37';
var gars2geo = CoordManager.GARS2Geo(gars);
var lon = parseFloat(gars2geo.split(',')[0]);
var lat = parseFloat(gars2geo.split(',')[1]);
//126.5, 37.5
console.log(lon, lat);
Parameters:
Name | Type | Description |
---|---|---|
gars |
string | GARS 좌표값 |
Returns:
위경도 좌표값 반환
- Type
- string
(static) Geo2DMS(lon, lat) → {string|object}
입력한 좌표값(경도, 위도)을 도분초(126° 00′ 05.31″ E) 변환한다.
Example
//경위도 좌표값을 도분초로 환산한다.
var geo2dms = window.CoordManager.Geo2DMS(127.56, 37.89);
var geoDMS = geo2dms.toString('dms').split(',');
var lon = geoDMS[0];
var lat = geoDMS[1];
//'126°30′00″E', ' 37°30′00″N'
console.log(lon, lat);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 좌표값(decimal degree) |
lat |
number | 위도 좌표값(decimal degree) |
Returns:
도분초로 환산된 좌표값 반환
- Type
- string | object
(static) Geo2GARS(lat, lon, precision) → {string}
입력한 경위도 좌표값을 GARS 좌표값으로 변환한다.
Example
var lon = 126.5;
var lat = 37.5;
var geo2gars = CoordManager.Geo2GARS(lat, lon, '5');
//614LR37
console.log(geo2gars);
Parameters:
Name | Type | Default | Description |
---|---|---|---|
lat |
number | 위도 |
|
lon |
number | 경도 |
|
precision |
number |
5
|
정밀도 |
Returns:
GARS 좌표값 반환
- Type
- string
(static) Geo2GeoRef(lat, lon) → {string}
입력한 경위도 좌표값을 GeoRef 좌표값으로 변환한다.
Example
var geo2georef = window.CoordManager.Geo2GeoRef(37.5, 126.5);
//WJGH 30000 30000
console.log(geo2georef);
Parameters:
Name | Type | Description |
---|---|---|
lat |
number | 위도 |
lon |
number | 경도 |
Returns:
GeoRef 좌표값 반환
- Type
- string
(static) Geo2KCGRS(lat, lon) → {string}
입력한 경위도 좌표값을 KCGRS 좌표값으로 변환한다.
Parameters:
Name | Type | Description |
---|---|---|
lat |
number | 위도 |
lon |
number | 경도 |
Returns:
KCGRS 좌표값 반환
- Type
- string
(static) Geo2MGRS(lon, lat) → {string}
입력한 경위도 좌표값을 MGRS 좌표값으로 변환한다.
Example
var geo2mgrs = CoordManager.Geo2MGRS(126.5, 37.5);
//52 S BG 79006 53277
console.log(geo2mgrs.zone, geo2mgrs.band, geo2mgrs.e100k+geo2mgrs.n100k, geo2mgrs.easting, geo2mgrs.northing);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 |
lat |
number | 위도 |
Returns:
MGRS 좌표값 반환
- Type
- string
(static) Geo2TM(lon, lat, epsg)
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 |
lat |
number | 위도 |
epsg |
string | EPSG 기준원점('EPSG:5186' - 중부원점) |
Returns:
TM 좌표값(x/y)을 배열형식으로 반환
(static) Geo2UTM(lon, lat, xy)
입력한 경위도 좌표값(경도, 위도)을 UTM 좌표값으로 변환한다.
Example
var lon = 127;
var lat = 37;
var xy = new Array(2);
var zone = parseInt(Math.floor((lon + 180.0) / 6) + 1);
var hemisphere = CoordManager.Geo2UTM(lon, lat, xy);
//52 'N' 322037.81022032636 4096742.0590864825로 출력
console.log(zone, hemisphere, xy[0], xy[1]);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | |
lat |
number | |
xy |
array |
Returns:
북반구('N')와 남반구('S') 구역을 반환한다.
(static) Geo2UTM_Ex(lon, lat) → {number|object}
입력한 경위도 좌표값을 UTM 좌표값으로 변환한다. Band 값은 MGRS 기준이 적용된다.
Example
var geo2utm = CoordManager.Geo2UTM_Ex(126.5, 37.5);
//zone: 52
//band: "S"
//easting: 282811.246584
//northing: 4157804.117472
console.log(geo2utm.zone, geo2utm.band, geo2utm.easting, geo2utm.northing);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 |
lat |
number | 위도 |
Returns:
UTM 좌표 객체(zone, band, easting, northing) 반환
- Type
- number | object
(static) GeoRef2Geo(georef) → {string}
입력한 GeoRef 좌표값을 위경도 좌표값으로 변환한다.
Example
var georef = 'WJGH 30000 30000';
var georefVal = georef.replace(/ /g,""); // 위경도 좌표값으로 변환한다.
//126.5, 37.5
var georef2geo = CoordManager.GeoRef2Geo(georefVal);
Parameters:
Name | Type | Description |
---|---|---|
georef |
string | GeoRef 좌표값 |
Returns:
위경도 좌표값 반환
- Type
- string
(static) getGeoCenter() → {number|object}
현재 화면 영역에 대한 중심좌표(경도, 위도)를 반환한다.
Example
let geo = CoordManager.getGeoCenter();
console.log(geo.lon, geo.lat);
Returns:
화면 중심 좌표 객체(lon, lat) 반환
- Type
- number | object
(static) getOLProj() → {object}
Openlayers olProj 객체를 반환한다.
Returns:
Projection 객체를 반환한다.
- Type
- object
(static) KCGRS2Geo(kcgrs) → {string}
입력한 KCGRS 좌표값을 위경도 좌표값으로 변환한다.
Parameters:
Name | Type | Description |
---|---|---|
kcgrs |
string | KCGRS 좌표값 |
Returns:
위경도 좌표값 반환
- Type
- string
(static) MGRS2Geo(mgrs) → {string}
입력한 MGRS 좌표값을 위경도 좌표값으로 변환한다.
Example
var mgrs = {
zone: '52',
band: 'S',
e100k: 'B',
n100k: 'G',
easting: 79006,
northing: 53277
};
var mgrs2geo = CoordManager.MGRS2Geo(mgrs);
//lon : 126.5, lat : 37.5
console.log(mgrs2geo.lon, mgrs2geo.lat);
Parameters:
Name | Type | Description |
---|---|---|
mgrs |
object | MGRS 좌표값 |
Returns:
위경도 좌표값 반환
- Type
- string
(static) setGeoAnimatedMoveCenter(lon, lat, duration)
입력한 중심좌표(경도, 위도) 위치로 설정한 이동시간 만큼 애니메이션 형식으로 이동한다.
Example
//3초 동안 비행하며 입력좌표로 중심이동 한다.
CoordManager.setGeoAnimatedMoveCenter(127, 37, 3);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 좌표값(decimal degree) |
lat |
number | 위도 좌표값(decimal degree) |
duration |
number | 이동 시간(초단위) |
(static) setGeoMoveCenter(lon, lat)
입력한 중심좌표(경도, 위도) 위치로 바로 이동된다.
Example
//입력좌표로 즉시 중심이동 한다.
CoordManager.setGeoMoveCenter(127, 37);
Parameters:
Name | Type | Description |
---|---|---|
lon |
number | 경도 좌표값(decimal degree) |
lat |
number | 위도 좌표값(decimal degree) |
(static) TM2Geo(x, }, epsg)
Parameters:
Name | Type | Description |
---|---|---|
x |
number | x 좌표 |
} |
number | y - y 좌표 |
epsg |
string | EPSG 기준원점('EPSG:5186' - 중부원점) |
Returns:
경위도(lon, lat) 좌표값을 배열형식으로 반환
(static) UTM2Geo(x, y, zone, hemisphere, xy) → {number}
입력한 UTM 좌표값을 경위도로 변환한다.
Example
var xy = new Array(2);
CoordManager.UTM2Geo(322037.81022032636, 4096742.0590864825, '52', 'N', xy);
//127, 37로 출력
console.log(xy[0], xy[1]);
Parameters:
Name | Type | Description |
---|---|---|
x |
number | 동향가수 |
y |
number | 북향가수 |
zone |
number | UTM 영역 |
hemisphere |
number | 북반구(N) 혹은 남반구(S) |
xy |
number | 경도(xy[0])와 위도(xy[1])로 변환된 좌표값 전달 |
Returns:
정상처리될 경우 true 값 반환
- Type
- number
(static) UTM2Geo_Ex(zone, band, easting, northing) → {number|object}
입력한 UTM 좌표값을 경위도 좌표값으로 변환한다. Band 값은 MGRS 기준이 적용된다.
Example
var utm2geo = CoordManager.UTM2Geo_Ex(52, 'S', 282811.246584, 4157804.117472);
//lon : 126.5, lat : 37.5
console.log(utm2geo.lon, utm2geo.lat);
Parameters:
Name | Type | Description |
---|---|---|
zone |
number | UTM 설정 영역 |
band |
number | 영역별 Band 값 |
easting |
number | 동향가수 |
northing |
number | 북향가수 |
Returns:
경위도 좌표 객체(lon, lat) 반환
- Type
- number | object