comparison pkg/octree/loader.go @ 4656:a2f16987911b stree-experiment

Removed lz4 from loader, too.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 14 Oct 2019 13:18:15 +0200
parents f5fce22184da
children 4bbfe3dd2ab5
comparison
equal deleted inserted replaced
4654:3eda5a7215ab 4656:a2f16987911b
14 package octree 14 package octree
15 15
16 import ( 16 import (
17 "bufio" 17 "bufio"
18 "bytes" 18 "bytes"
19 "compress/gzip"
19 "encoding/binary" 20 "encoding/binary"
20 "log" 21 "log"
21 22
22 "github.com/golang/snappy" 23 "github.com/golang/snappy"
23 "github.com/pierrec/lz4"
24 ) 24 )
25 25
26 func (s *STRTree) deserializeIndex(r *bufio.Reader) error { 26 func (s *STRTree) deserializeIndex(r *bufio.Reader) error {
27 var numIndex int32 27 var numIndex int32
28 if err := binary.Read(r, binary.LittleEndian, &numIndex); err != nil { 28 if err := binary.Read(r, binary.LittleEndian, &numIndex); err != nil {
90 90
91 return s.deserializeBBoxes(r) 91 return s.deserializeBBoxes(r)
92 } 92 }
93 93
94 func (s *STRTree) FromBytes(data []byte) error { 94 func (s *STRTree) FromBytes(data []byte) error {
95 return s.deserialize( 95 r, err := gzip.NewReader(bytes.NewReader(data))
96 bufio.NewReader( 96 if err != nil {
97 lz4.NewReader( 97 return err
98 bytes.NewReader(data)))) 98 }
99 return s.deserialize(bufio.NewReader(r))
99 } 100 }
100 101
101 func (t *Tin) Deserialize(r *bufio.Reader) error { 102 func (t *Tin) Deserialize(r *bufio.Reader) error {
102 103
103 if err := binary.Read(r, binary.LittleEndian, &t.EPSG); err != nil { 104 if err := binary.Read(r, binary.LittleEndian, &t.EPSG); err != nil {