npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sd.florida/naver-map-lib

v0.1.2

Published

frontend naver-map library

Downloads

5

Readme

@sd.florida/naver-map-lib

소개

vue3에서 네이버 지도 API를 쉽게 사용하기 위한 라이브러리 입니다.

모든 소스코드는 네이버 지도 API v3를 기반으로 만들었습니다.
(링크 : https://navermaps.github.io/maps.js.ncp/docs/)


npm

npm install @sd.florida/naver-map-lib

Example

  1. 지도 불러오기
<template>
  <Map :apiKey="naverMapApiKey" :options="mapOptions" width="100%" height="800px">
  </Map>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { Map } from '@sd.florida/naver-map-lib'

const naverMapApiKey = '발급받은 네이버지도 API 키'
const mapOptions = ref({
  centerPosition: { lat: centerPositionLat, lng: centerPositionLng },
  zoom: 12,
  onZoomChanged: (zoomLevel: number) => {
    console.log(zoomLevel)
  },
})

</script>
  1. 마커 표시하기

<template>
  <Map :apiKey="naverMapApiKey" :options="mapOptions" width="100%" height="800px">
    <Marker :marker="markerOption"/>
  </Map>
</template>
<script setup lang="ts">
import { Map, Marker } from '@sd.florida/naver-map-lib'
import { ref } from "vue";

const markerOption = ref({
  id: 'a-1',
  onClick: (e: any, marker: any) => {
    console.log(e, marker)
  },
  position: {
    lat: 37.5301893,
    lng: 126.9261367
  },
  clickable: true,
  draggable: true,
  onDragend: (e: any) => {
    console.log('drag end', e)
  },
  /* 기타 옵션들은 MarkerOption 참고 https://navermaps.github.io/maps.js.ncp/docs/naver.maps.Marker.html */
})

</script>
  1. Polygon 표시
<template>
  <Map :apiKey="naverMapApiKey" :options="mapOptions" width="100%" height="800px">
    <Polygon :polygon="polygon"/>
  </Map>
</template>

<script setup lang="ts">
import { Map, Polygon } from '@sd.florida/naver-map-lib'
import { ref } from "vue";

const polygon = ref({
  paths: [{ lat: {위도}, lng: {경도} }, ...], // 단일 Array 로 처리
  /* 기타 옵션들은 PolygonOption 참고 https://navermaps.github.io/maps.js.ncp/docs/naver.maps.Polygon.html */
})
</script>
  1. Polyline 표시
<template>
  <Map :apiKey="naverMapApiKey" :options="mapOptions" width="100%" height="800px">
    <Polyline :polyline="polyline"/>
  </Map>
</template>

<script setup lang="ts">
import { Map, Polyline } from '@sd.florida/naver-map-lib'
import { ref } from "vue";

const polyline = ref({
  path: [{ lat: {위도}, lng: {경도} }, ...]
  /* 기타 옵션들은 PolylineOption 참고 https://navermaps.github.io/maps.js.ncp/docs/naver.maps.Polyline.html */
})
</script>
  1. InfoWindow 표시
<template>
  <Map :apiKey="naverMapApiKey" :options="mapOptions" width="100%" height="800px">
    <InfoWindow :infoWindow="infoWindowOption" @onLoad="infoWindowLoaded" />
  </Map>
</template>

<script setup lang="ts">
import { Map, InfoWindow } from '@sd.florida/naver-map-lib'
import { ref } from "vue";

const infoWindow = ref() // infoWindow 컴포넌트 ref 객체
const infoWindowOption = ref({
  content: `컨텐츠`,
  position: {lat: 0, lng: 0},
  onOpen: (e: any, infoWindow: any) => {
    /* open event listener */
  },
  onClose: (e: any, infoWindow: any) => {
    /* close event listener */
  }
})


const infoWindow1Loaded = (info: any) => {
  infoWindow.value = info
}

// 지도 위에 인포윈도우 열기
function infoWindowOpen() {
  infoWindowOption.value = {
    content: 'test contents', // HTML DOM String으로 작성
    position: { lat: {위도}, lng: {경도} }
  }
  infoWindow.value.open()
}

// 마커 위에서 인포윈도우 열기
function infoWindowOpenOnMarker(marker) {
  infoWindowOption.value = {
    content: 'test contents', // HTML DOM String으로 작성
    position: { lat: marker.position.y, lng: marker.position.x }
  }
  infoWindow.value.open(marker)
}