@@ -47,16 +47,10 @@ module.exports = function (item, deps) {
4747 coords . push ( deps [ ref ] . lat )
4848 } )
4949 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 )
5751 var labelLen = getLabelLen ( item . tags )
5852 var buf = Buffer . alloc ( 1 + typeLen + idLen + pCount + cLen + n * 4 * 2
59- + ( n - 2 ) * 3 * 2 + labelLen )
53+ + cells . length + labelLen )
6054 var offset = 0
6155 buf . writeUInt8 ( 0x03 , 0 )
6256 offset += 1
@@ -72,10 +66,10 @@ module.exports = function (item, deps) {
7266 buf . writeFloatLE ( deps [ ref ] . lat , offset )
7367 offset += 4
7468 } )
75- varint . encode ( cells . length / 3 , buf , offset )
69+ varint . encode ( earcut . length , buf , offset )
7670 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 )
7973 offset += varint . encode . bytes
8074 } )
8175 writeLabelData ( item . tags , buf , offset )
0 commit comments