Package Exports
- dji-kmz-parser
- dji-kmz-parser/lib/index.js
- dji-kmz-parser/lib/index.umd.cjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dji-kmz-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Dji-kmz-parser
Usage
pnpm add dji-kmz-parser
kmzToJson
Convert KMZ file (with Blob format) to JSON.
<script setup lang="ts"> import kmzFile from '/files/flight.kmz?url' import { kmzToJson } from 'dji-kmz-parser/lib' fetch(kmzFile) .then(async (res: Response) => { const obj = await kmzToJson(res) console.log(obj) }) .catch((err: string) => console.log(err)) </script>
jsonToKmz
Convert JSON to KMZ file.
<script setup lang="ts"> import flightObj from '/files/flightObj.ts' import { jsonToKmz } from 'dji-kmz-parser/lib' jsonToKmz(flightObj).then((res: Blob) => { const a = document.createElement('a') a.href = window.URL.createObjectURL(res) a.download = 'flight.kmz' a.click() }).catch((err: string) => console.log(err)) </script>