[React] 네이버지도 api

KoEunseo·2023년 3월 9일
0

리액트

목록 보기
18/21

네이버 지도 api 예제
https://navermaps.github.io/maps.js.ncp/docs/tutorial-2-Getting-Started.html

로그인 api와 달리 지도 api는 공식문서에 설명이 잘되어있다.

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <title>간단한 지도 표시하기</title>
    <script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=YOUR_CLIENT_ID"></script>
</head>
<body>
<div id="map" style="width:100%;height:400px;"></div>

<script>
var mapOptions = {
    center: new naver.maps.LatLng(37.3595704, 127.105399),
    zoom: 10
};

var map = new naver.maps.Map('map', mapOptions);
</script>
</body>
</html>

그리고 react로 네이버맵을 연동하는데 도움을 주는 라이브러리가 있다. 챗gpt는 김민준님이 만든거라고 하는데... 맞는지는 모르겠다. 또 헛소리한듯;

https://zeakd.github.io/react-naver-maps/

npm install --save react-naver-maps

네이버에서 제공하는 타입스크립트도 다운한다.

npm install --save @types/navermaps
profile
주니어 플러터 개발자의 고군분투기

0개의 댓글