Skip to content

NAVER Map

NAVER Map 是 NAVER 推出的地图和导航应用。Protocol Launcher 允许你生成 NAVER Map URL Scheme 链接。

用法

这个库有两种使用方式:

  • On-Demand 从子路径导入,支持 tree-shaking,打包体积更小。
  • Full Import 从根包导入,适合快速脚本或 demo,但会包含所有应用模块。

生产构建推荐使用 On-Demand;快速试用可以使用 Full Import。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

说明

NAVER 的 URL Scheme 要求传入 appname 参数,用来标识发起调用的应用或网页。此模块只为官方文档列出的 nmap:// action path 暴露 helper:mapplacesearchsearch/busroute/publicroute/carroute/walkroute/bicyclenavigation

打开 NAVER Map

On-Demand
ts
import { openMap } from 'protocol-launcher/naver-map'

const url = openMap({
  lat: 37.56661,
  lng: 126.978388,
  zoom: 13,
  appname: 'com.example.myapp',
})

标记坐标

On-Demand
ts
import { showPoint } from 'protocol-launcher/naver-map'

const url = showPoint({
  lat: 37.56661,
  lng: 126.978388,
  name: '서울역',
  appname: 'com.example.myapp',
})

搜索

On-Demand
ts
import { search } from 'protocol-launcher/naver-map'

const url = search({
  query: '카페',
  appname: 'com.example.myapp',
})

公交搜索

On-Demand
ts
import { searchBus } from 'protocol-launcher/naver-map'

const url = searchBus({
  query: 'M4101',
  appname: 'com.example.myapp',
})

路线

On-Demand
ts
import { route } from 'protocol-launcher/naver-map'

const url = route({
  mode: 'car',
  dlat: 37.5209436,
  dlng: 127.1230074,
  dname: '올림픽공원',
  appname: 'com.example.myapp',
})

导航

On-Demand
ts
import { navigation } from 'protocol-launcher/naver-map'

const url = navigation({
  appname: 'com.example.myapp',
})

官方文档