# Leaflet.Deflate
**Repository Path**: gisxiaowei/Leaflet.Deflate
## Basic Information
- **Project Name**: Leaflet.Deflate
- **Description**: Deflates lines and polygons to a marker when their screen size becomes too small in lower zoom levels.
- **Primary Language**: HTML
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2019-12-19
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Leaflet.Deflate
[](https://travis-ci.org/oliverroick/Leaflet.Deflate)
[](https://greenkeeper.io/)
Substitutes polygons and lines with markers when their screen size falls below a defined threshold.

(**NOTE:** The following refence reflects pre-release version 1.0-alpha.2. If you're looking to use the latest stable release, please refer to the [maintenance/0.3 branch](https://github.com/oliverroick/Leaflet.Deflate/tree/maintenance/0.3).)
## Installation
### Using a hosted version
Include the source into the `head` section of your document.
```html
```
### Install via NPM
If you use the [npm package manager](https://www.npmjs.com/), you can fetch a local copy by running:
```bash
npm install Leaflet.Deflate@1.0.0-alpha.2
```
改成
```bash
cnpm install https://github.com/gisxiaowei/Leaflet.Deflate --save
```
You will find a copy of the release files in `node_modules/Leaflet.Deflate/dist`.
## API
### `L.Deflate`
The central class of the `Leaflet.Deflate`. It is used to create a feature group that deflates all layers added to the group.
#### Usage example
Initialize a new `L.Deflate` feature group, add it too your map and add layers you want to deflate.
```javascript
var map = L.map("map");
var features = L.deflate({minSize: 10})
features.addTo(map);
// add layers
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
])
.addTo(features);
// works with GeoJSONLayer too
L.geoJson(json).addTo(features);
```
#### Creation
Factory | Description
---------------------------- | -------------
`L.deflate(