상단영역 바로가기 오픈 API 소개 영역 바로가기 하단영역 바로가기
오픈 API
1. 소개

  국사편찬위원회 역사지리정보 데이터베이스가 제공하는 1919년, 1970년대 배경지도를 제공합니다.

  요청 URL을 인증받은 키 값과 함께 QGIS 프로그램 WMTS 레이어로 추가하거나 사용자 클라이언트에 Javascript 소스로 추가하시면 사용하실 수 있습니다.

2. 요청 URL

QGIS 레이어

https://hgis.history.go.kr/openapi/get.do?Service=WMTS&Request=GetCapabilities&apiKey=[인증키]

Javascript

https://hgis.history.go.kr/openapi/get.do?apiKey=[인증키]

3. 서비스 대상
배경지도 레이어 이름
1919년도 배경지도 map1919
1919년도 배경지도 도엽정보 map1919_index
1970년대 배경지도 map1970
1970년대 배경지도 도엽정보 map1970_index
4. 주요 오류 코드
상태 코드(오류 유형) 오류 발생 원인 해결 방법
400(요청 변수 확인) 필수 요청 변수가 없거나 요청 변수 이름이 잘못된 경우 API 필수 요청 변수를 확인합니다.
401(인증 실패) API 권한이 설정되지 않은 경우 or API키가 잘못된 경우 API 권한과 API키를 확인합니다.
500(서버 오류) 필수 요청 변수가 없거나 요청 변수 이름이 잘못된 경우 API 필수 요청 변수를 확인합니다.
5. 기본 예제

QGIS

qgis 예제

javascript

							<html>
							  <head>
							    <title>WMTS</title>
							    <link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css">
							    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
							    <script src="https://openlayers.org/en/v4.6.5/build/ol.js"></script>
								<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.1/proj4.min.js"></script>
							  </head>
							  <body>
							    <div id="map" class="map"></div>
							    <script>
									/*******************************************************************************
									 * 1 Define Gis Object
									 ******************************************************************************/
									// Projection 위경도 좌표계
									proj4.defs("EPSG:5179", '+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 extent = [ -196258.9235346972709522, 1132702.6936850615311414,
													2439704.8100087596103549, 2976231.2994817341677845 ];
							
									var center = ol.proj.transform([ 126.97975155175968, 37.42433704094878 ], "EPSG:4326", "EPSG:5179");
									
									var zoom = 13;
									var zoomMin = 7;
									var zoomMax = 17;
									
									// View
									var view = new ol.View({
										extent : extent,
										projection: "EPSG:5179",
										center: center,
										zoom: 13,
										minZoom: 7,
										maxZoom: 17,
										constrainResolution : true
									});
									
									/*******************************************************************************
									 * 2 Base Maps
									 ******************************************************************************/
									var gridNames = [ 'EPSG:5179:0', 'EPSG:5179:1', 'EPSG:5179:2', 'EPSG:5179:3',
														'EPSG:5179:4', 'EPSG:5179:5', 'EPSG:5179:6', 'EPSG:5179:7',
														'EPSG:5179:8', 'EPSG:5179:9', 'EPSG:5179:10', 'EPSG:5179:11',
														'EPSG:5179:12' ];
									var resolutions = [ 15636.779110998164, 7818.389555499082, 3909.194777749541,
														1954.5973888747706, 977.2986944373853, 488.64934721869264,
														244.32467360934632, 122.16233680467316, 61.08116840233658,
														30.54058420116829, 15.270292100584145, 7.6351460502920725,
														3.8175730251460362 ];
									
									var map1970 = new ol.layer.Tile({
										type : "base",
										id : "1970",
										source : new ol.source.WMTS({
											// 개발서버용. 운영서버 적용 시 URL 변경
											url : "https://hgis.history.go.kr/openapi/get.do?apiKey=[API_KEY]",
											layer : "history:map1970",
											matrixSet : "EPSG:5179",
											format : 'image/png',
											projection : "EPSG:5179",
											tileGrid : new ol.tilegrid.WMTS({
												tileSize : [ 256, 256 ],
												extent : [ 815164.9555917948, 1455946.3608951417,
														1220536.614974792, 2075064.925722272 ],
												origin : [ -200000.000000000, 4000000.000000000 ],
												resolutions : resolutions,
												matrixIds : gridNames
											}),
											wrapX : true,
											serverType : "geoserver"
										}),
										visible : true
									});
									
									/*******************************************************************************
									 * 3 Map
									 ******************************************************************************/
									// Map
									var	map = new ol.Map({
										target: 'map',
										layers: [ map1970 ],
										loadTilesWhileInteracting: true,
										controls: ol.control.defaults({
											rotate: false,
											attribution : false,
											zoom : false,
											attributionOptions: ({
												collapsible: false
											})
										}).extend([]),
										interactions: ol.interaction.defaults({
											altShiftDragRotate:false, pinchRotate:false
										}),
										view: view,
										logo:false
									});
									
							    </script>
							  </body>
							</html>