# kmljs

> JavaScript KML parser library

Latest version **0.0.1** (published 2018-07-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install kmljs
pnpm add kmljs
yarn add kmljs
bun add kmljs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-07-08 |
| First published | 2018-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 541.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | enkatsu |
| Maintainers | enkatsu |
| Keywords | kml, xml |

## Links

- npm: https://www.npmjs.com/package/kmljs
- Repository: https://github.com/endoh0509/kml.js
- Issues: https://github.com/endoh0509/kml.js/issues
- npm.io page: https://npm.io/package/kmljs

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2018-07-08

## README

# kml.js

[![Build Status](https://travis-ci.org/endoh0509/kml.js.svg?branch=master)](https://travis-ci.org/endoh0509/kml.js)
![license](https://img.shields.io/github/license/mashape/apistatus.svg)

JavaScript KML parser library

## Installation

```sh
npm install kmljs --save
yarn add kmljs
bower install kmljs --save
```

## Usage

[TypeDoc](https://endoh0509.github.io/kml.js/)

### Sample KML
```xml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>sample doc</name>
    <Style id="icon-1899-0288D1-nodesc-normal">
      <IconStyle>
        <color>ffd18802</color>
        <scale>1</scale>
        <Icon>
          <href>http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
      <BalloonStyle>
        <text><![CDATA[<h3>$[name]</h3>]]></text>
      </BalloonStyle>
    </Style>
    <Placemark>
      <name>sample mark</name>
      <styleUrl>#icon-1899-0288D1-nodesc</styleUrl>
      <Point>
        <coordinates>
          139.4085320,35.6451853,0
        </coordinates>
      </Point>
    </Placemark>
  </Document>
</kml>
```

### Javascript

```js
var kmljs = require('kmljs');
var fs = require('fs');
var buffer = fs.readFileSync('KML_PATH');
var kmlDocument = new kmljs.KmlDocument(buffer.toString());
for(var placemark of kmlDocument.placemarks) {
  console.log(placemark);
}
```

### TypeScript

```bash
npm install --save fs-extra @types/fs-extra
```

```ts
import { KmlDocument } from 'kmljs';
import * as fs from 'fs-extra';
const buffer = fs.readFileSync('KML_PATH');
const kmlDocument = new KmlDocument(buffer.toString());
for(const placemark of kmlDocument.placemarks) {
  console.log(placemark);
}
```

## Test

```sh
npm test
```

## Build

```sh
npm run build
```

## License

MIT License

---
_Source: https://npm.io/package/kmljs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
