Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kml-geojson

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kml-geojson

kml与geojson互转工具类

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-34.37%
Maintainers
0
Weekly downloads
 
Created
Source

kml-geojson (kgUtil)

kml或kmz格式 与 GeoJSON格式 互相转换工具类(kgUtil)

运行命令

首次运行前安装依赖

npm installcnpm install

打包编译项目

运行npm run build来构建项目。

使用示例

安装及引入

安装包

npm install kml-geojson -save 

引入包

import * as kgUtil from './conver/geoJSONToKml' 
//或者
//import {toGeoJSON,tokml} from './conver/geoJSONToKml'

KML转GeoJSON示例:

//直接加载url
kgUtil.toGeoJSON('//data.mars3d.cn/file/kml/NAVWARN.kmz').then((geojoson) => {
  console.log(geojoson) 
})

//加载input文件控件的二进制流
kgUtil.toGeoJSON(this.files[0]).then((geojoson) => {
  console.log(geojoson) 
})

//加载kml文档对象
$.ajax('//data.mars3d.cn/file/kml/dg8.kml').done(function (xml) {
  kgUtil.toGeoJSON(xml).then((geojoson) => {
    console.log(geojoson) 
  })
})

GeoJSON转KML示例

var kml = kgUtil.tokml(geojsonObject, {
  name: 'Mars3D标绘数据',
  documentName: 'Mars3D标绘数据文件',
  documentDescription: '标绘数据 by mars3d.cn',
  simplestyle: true,
}) 

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc