@@ -47,16 +47,10 @@ module.exports = function (item, deps) {
47
47
coords . push ( deps [ ref ] . lat )
48
48
} )
49
49
var cells = earcut ( coords )
50
- var coords = [ ]
51
- item . refs . forEach ( function ( ref ) {
52
- coords . push ( deps [ ref ] . lon )
53
- coords . push ( deps [ ref ] . lat )
54
- } )
55
- var cells = earcut ( coords )
56
- var cLen = varint . encodingLength ( earcut . length / 3 )
50
+ var cLen = varint . encodingLength ( earcut . length )
57
51
var labelLen = getLabelLen ( item . tags )
58
52
var buf = Buffer . alloc ( 1 + typeLen + idLen + pCount + cLen + n * 4 * 2
59
- + ( n - 2 ) * 3 * 2 + labelLen )
53
+ + cells . length + labelLen )
60
54
var offset = 0
61
55
buf . writeUInt8 ( 0x03 , 0 )
62
56
offset += 1
@@ -72,10 +66,10 @@ module.exports = function (item, deps) {
72
66
buf . writeFloatLE ( deps [ ref ] . lat , offset )
73
67
offset += 4
74
68
} )
75
- varint . encode ( cells . length / 3 , buf , offset )
69
+ varint . encode ( earcut . length , buf , offset )
76
70
offset += varint . encode . bytes
77
- cells . forEach ( function ( item ) {
78
- varint . encode ( item , buf , offset )
71
+ cells . forEach ( function ( cell ) {
72
+ varint . encode ( cell , buf , offset )
79
73
offset += varint . encode . bytes
80
74
} )
81
75
writeLabelData ( item . tags , buf , offset )
0 commit comments