shp-geojson

2.0.0 • Public • Published

shp-geojson (shpUtil)

shp 格式 与 GeoJSON 格式 互相转换工具类(shpUtil)

运行命令

首次运行前安装依赖

npm installcnpm install

打包编译项目

运行npm run build来构建项目。

使用示例

安装及引入

安装包

npm install shp-geojson -save

引入包

import * as shpUtil from 'shp-geojson'
//或者
//import { toGeoJSON } from 'shp-geojson'

SHP 转 GeoJSON 示例:

//直接加载url
shpUtil.toGeoJSON('//data.mars3d.cn/file/shp/test.zip').then((geojoson) => {
  console.log(geojoson)
})

//如果您以其他方式获得 zip(例如File API),则可以使用 arrayBuffer 调用
shpUtil.toGeoJSON(buffer).then((geojoson) => {
  console.log(geojoson)
})

/shp-geojson/

    Package Sidebar

    Install

    npm i shp-geojson

    Weekly Downloads

    9

    Version

    2.0.0

    License

    Apache-2.0

    Unpacked Size

    1.08 MB

    Total Files

    5

    Last publish

    Collaborators

    • muyao1987