You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var data =fs.readFileSync(__dirname+'/fixtures/rectangle-1.0.0.pbf')
21
23
var tile =newVectorTile(newProtobuf(data))
22
24
var orig =tile.layers['geojsonLayer'].feature(0).toGeoJSON(0, 0, 1)
23
25
24
-
var buff =vtpbf(tile)
26
+
var buff =fromVectorTileJs(tile)
25
27
fs.writeFileSync('my-tile.pbf', buff)
26
28
```
27
29
28
30
## From geojson-vt
29
31
30
32
```javascript
31
-
var vtpbf =require('vt-pbf')
32
-
var geojsonVt =require('geojson-vt')
33
+
import {fromGeojsonVt} from'vt-pbf'
34
+
importgeojsonVtfrom'geojson-vt'
33
35
34
36
var orig =JSON.parse(fs.readFileSync(__dirname+'/fixtures/rectangle.geojson'))
35
37
var tileindex =geojsonVt(orig)
36
38
var tile =tileindex.getTile(1, 0, 0)
37
39
38
40
// pass in an object mapping layername -> tile object
39
-
var buff =vtpbf.fromGeojsonVt({ 'geojsonLayer': tile })
41
+
var buff =fromGeojsonVt({ 'geojsonLayer': tile })
40
42
fs.writeFileSync('my-tile.pbf', buff)
41
43
```
42
44
43
-
`vtpbf.fromGeojsonVt` takes two arguments:
45
+
`fromGeojsonVt` takes two arguments:
44
46
-`layerMap` is an object where keys are layer names and values are a geojson-vt tile,
45
47
-`options` is an object (optional argument). There are 2 supported keys: `version` to define the version of the mvt spec used and `extent` to define the extent of the tile. `version` defaults to 1 and `extent` to 4096.
0 commit comments