# Leaflet.VectorGrid
Display gridded vector data (sliced [GeoJSON](http://geojson.org/), [TopoJSON](https://github.com/mbostock/topojson/wiki) or [protobuf vector tiles](https://github.com/mapbox/vector-tile-spec)) in [Leaflet](http://www.leafletjs.com) 1.0.0
## Demos
| | |
| --- | --- |
| [`demo-geojson.html`](http://leaflet.github.io/Leaflet.VectorGrid/demo-geojson.html) | Sliced GeoJSON |
| [`demo-topojson.html`](http://leaflet.github.io/Leaflet.VectorGrid/demo-topojson.html) | Sliced TopoJSON (sorry for the antimeridian mess, topojson-to-geojson seems to not handle it properly) |
| [`demo-vectortiles.html`](http://leaflet.github.io/Leaflet.VectorGrid/demo-vectortiles.html) | Protobuf vector tiles: OpenMapTiles, MapBox, MapZen or even ESRI vector tiles |
| [`demo-points.html`](http://leaflet.github.io/Leaflet.VectorGrid/demo-points.html) | Clickable points and lines |
| [`demo-points-icons.html`](http://leaflet.github.io/Leaflet.VectorGrid/demo-points-icons.html) | Points as icons |
## Using
If you use `npm`:
```
npm install leaflet.vectorgrid
```
That will make available two files: `dist/Leaflet.VectorGrid.js` and `dist/Leaflet.VectorGrid.bundled.js`.
The difference is that `dist/Leaflet.VectorGrid.bundled.js` includes all of `VectorGrid`'s dependencies:
* [geojson-vt](https://github.com/mapbox/geojson-vt) (Under ISC license)
* [pbf](https://github.com/mapbox/pbf) (Under BSD license)
* [topojson](https://github.com/mbostock/topojson) (Under BSD license)
* [vector-tile](https://github.com/mapbox/vector-tile-js) (Under BSD license)
If you are adding these dependencies by yourself, use `dist/Leaflet.VectorGrid.js` instead.
If you don't want to deal with `npm` and local files, you can use `unpkg.com` instead:
```
<script src="https://unpkg.com/leaflet.vectorgrid@latest/dist/Leaflet.VectorGrid.bundled.js"></script>
```
or, with the same caveats about bundled dependencies:
```
<script src="https://unpkg.com/leaflet.vectorgrid@latest/dist/Leaflet.VectorGrid.js"></script>
```
## Docs
This plugin exposes two new classes:
* `L.VectorGrid.Slicer` for displaying GeoJSON or TopoJSON data
* `L.VectorGrid.Protobuf` for displaying vector tiles from an online tile server
You can find the API documentation, and the explanation about the styling, at:
http://leaflet.github.io/Leaflet.VectorGrid/vectorgrid-api-docs.html
## Dependencies
`L.VectorGrid.Slicer` requires `geojson-vt`: the global variable `geojsonvt` must exist. If topojson data is used, then the `topojson` global variable must also exist.
`L.VectorGrid.Protobuf` requires `vector-tile` and `pbf`: the global variables `VectorTile` and `Pbf` must exist.
By default, VectorGrid is built with those dependencies bundled.
## Developing
Run `npm install`.
## TODO
* Sub-panes for the tile renderers (to set the "z-index" of layers/features)
* More `<g>`roups in SVG
* Offscreen `<canvas>`es in Canvas
* `getBounds()` support for the slicer (inherit/extrapolate from geojson data)
* Parser for mapbox-like vector stylesheets
## Motivation
Before VectorGrid, loading vector tiles in Leaflet could only be done with the
Leaflet.MapboxVectorTile or the Hoverboard plugin, but neither of those works with
Leaflet 1.0.0 (or greater).
VectorGrid leverages the GridLayer feature introduced in Leaflet 1.0.0.
## Legalese
----------------------------------------------------------------------------
"THE BEER-WARE LICENSE":
<ivan@sanchezortega.es> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return.
----------------------------------------------------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
Leaflet.VectorGrid-1.3.0编译开发包
共57个文件
js:19个
hbs:18个
html:7个
需积分: 5 0 下载量 143 浏览量
2024-01-07
07:06:44
上传
评论
收藏 287KB ZIP 举报
温馨提示
这是一个面向二维的基于Leaflet的矢量瓦片渲染展示交互的资源包,主要在Leaflet下加载Mapbox的MVT、geojson等矢量瓦片的插件。资源包VectorGrid是1.3.0的编译版本 ,不需要再编译,适用与原生环境下进行矢量瓦片渲染展示,也适用于离线环境下的的渲染展示。编译好的js在dist目录下,前端可以直接引用即可,如果是vue等前端框架,可以采用自己的开发模式。本包主要是解决不会编译或者编译失败的朋友们,当做开箱即用的工具进行引入即可,方便快捷。
资源推荐
资源详情
资源评论
收起资源包目录
Leaflet.VectorGrid-1.3.0.zip (57个子文件)
Leaflet.VectorGrid-1.3.0
yarn.lock 65KB
.travis.yml 40B
src
Leaflet.VectorGrid.Slicer.js 3KB
Leaflet.Renderer.SVG.Tile.js 2KB
Leaflet.VectorGrid.js 7KB
Leaflet.Renderer.Canvas.Tile.js 2KB
slicerWebWorker.js 1KB
Symbolizer.PolyBase.js 621B
Symbolizer.Point.js 2KB
bundle.js 288B
bundle-extra.js 441B
Symbolizer.js 2KB
Leaflet.VectorGrid.Protobuf.js 5KB
Symbolizer.Fill.js 577B
Symbolizer.Line.js 740B
CHANGELOG.md 2KB
docs
demo-geojson.html 3KB
demo-points.html 4KB
main.css 15KB
vectorgrid-api-docs.html 19KB
demo-points-icons.html 4KB
eu-countries.js 115KB
demo-topojson.html 2KB
eu-countries.topo.json 60KB
demo-vectortiles.html 12KB
eu-countries.geo.json 115KB
dist
Leaflet.VectorGrid.bundled.min.js 47KB
Leaflet.VectorGrid.min.js 40KB
Leaflet.VectorGrid.js 90KB
vectorgrid-api-docs.html 15KB
Leaflet.VectorGrid.bundled.js 103KB
Leaflet.VectorGrid.bundled.js.map 151KB
Leaflet.VectorGrid.js.map 123KB
package.json 1KB
.eslintrc.json 89B
leafdoc-templates
option.hbs 349B
html.hbs 5KB
destructor.hbs 396B
comments.hbs 26B
crs.hbs 235B
function.hbs 452B
section.hbs 232B
projection.hbs 242B
property.hbs 284B
supersection.hbs 107B
inherited.hbs 223B
example.hbs 61B
factory.hbs 392B
namespace.hbs 138B
constructor.hbs 397B
event.hbs 281B
pane.hbs 347B
method.hbs 453B
.npmignore 103B
gobblefile.js 3KB
.gitignore 89B
README.md 4KB
共 57 条
- 1
资源评论
夜郎king
- 粉丝: 4w+
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功