Skip to content

Commit

Permalink
correction on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtekson committed Jul 23, 2021
1 parent f74308a commit fb9f54c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 37 deletions.
64 changes: 31 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,45 @@

It is a open-source leaflet plugin which generate the vector tiles for geojson data. It has the dev-dependency of [geojson-vt-leaflet](https://github.com/handygeospatial/geojson-vt-leaflet).

## Usage
## Demo

[DEMO](https://iamtekson.github.io/leaflet-geojson-vt/demo/)

## Installation and setup

- Using NPM:

```js
npm install leaflet-geojson-vt
```

- Quick use:

```js
<script src="https://unpkg.com/[email protected]/geojson-vt.js"></script>
<script src="[path to js]/leaflet-geojson-vt.js"></script>
```

## Usage

```js
var options = {
maxZoom: 16,
tolerance: 3,
debug: 0,
style: {
fillColor: '#1EB300',
color: '#F2FF00',
weight: 2
}
maxZoom: 16,
tolerance: 3,
debug: 0,
style: {
fillColor: "#1EB300",
color: "#F2FF00",
},
};
var canvasLayer = L.gridLayer.geoJson(json, options).addTo(map);
var vtLayer = L.geoJson.vt(geojson, options).addTo(map);
```

Options are included with [geojson-vt options](https://github.com/mapbox/geojson-vt#options) and [L.geojson style](http://leafletjs.com/reference.html#path-options).

```
The following are the default options from geojson-vt.

```js
var tileIndex = geojsonvt(data, {
maxZoom: 14, // max zoom to preserve detail on
tolerance: 3, // simplification tolerance (higher means simpler)
Expand All @@ -38,28 +58,6 @@ var tileIndex = geojsonvt(data, {

- [geojson-vt](https://github.com/mapbox/geojson-vt)

## Demo

[DEMO](https://brandonxiang.github.io/leaflet-geojson-vt/test)

## Test

run npm script with `browser-sync`

```
npm run dev
```

Browser on `http://localhost:3000/test`

## TODO

[TODO](doc/TODO.md)

## Changelog

[changelog](doc/changelog.md)

## License

[LICENSE](LICENSE)
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
debug: 0,
style: geojsonStyle
};
var canvasLayer = L.gridLayer.geoJson(data, options).addTo(map);
var canvasLayer = L.geoJson.vt(data, options).addTo(map);

console.log(canvasLayer)

Expand Down
6 changes: 3 additions & 3 deletions src/leaflet-geojson-vt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
L.GridLayer.GeoJSON = L.GridLayer.extend({
L.GeoJSON.VT = L.GridLayer.extend({
options: {
async: false,
},
Expand Down Expand Up @@ -98,8 +98,8 @@ L.GridLayer.GeoJSON = L.GridLayer.extend({
},
});

L.gridLayer.geoJson = function (geojson, options) {
return new L.GridLayer.GeoJSON(geojson, options);
L.geoJson.vt = function (geojson, options) {
return new L.GeoJSON.VT(geojson, options);
};

String.prototype.iscolorHex = function () {
Expand Down

0 comments on commit fb9f54c

Please sign in to comment.