Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.

Commit c35a4cf

Browse files
author
thisisaaronland
committed
block out conditional check for loading wof/alt features
1 parent e644056 commit c35a4cf

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

index.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/whosonfirst/warning"
1212
"io"
1313
"io/ioutil"
14-
"log"
14+
_ "log"
1515
)
1616

1717
func NewDefaultSQLiteFeaturesIndexer(db sqlite.Database, to_index []sqlite.Table) (*sql_index.SQLiteIndexer, error) {
@@ -30,20 +30,24 @@ func NewDefaultSQLiteFeaturesIndexer(db sqlite.Database, to_index []sqlite.Table
3030
return nil, err
3131
}
3232

33-
closer := ioutil.NopCloser(fh)
33+
body, err := ioutil.ReadAll(fh)
3434

35-
// blocked on support for loading/handling alt files in go-whosonfirst-geojson-v2
36-
// (as in alt files will always fail to load...)
37-
// https://github.com/whosonfirst/go-whosonfirst-geojson-v2/compare/alt
38-
// (20191029/thisisaaronland)
39-
40-
i, err := feature.LoadWOFFeatureFromReader(closer)
35+
if err != nil {
36+
return nil, err
37+
}
4138

42-
log.Println(path, err)
39+
i, err := feature.NewWOFFeature(body)
4340

4441
if err != nil && !warning.IsWarning(err) {
45-
msg := fmt.Sprintf("Unable to load %s, because %s", path, err)
46-
return nil, errors.New(msg)
42+
43+
alt, alt_err := feature.NewWOFAltFeature(body)
44+
45+
if alt_err != nil && !warning.IsWarning(alt_err) {
46+
msg := fmt.Sprintf("Unable to load %s, because %s (%s)", path, alt_err, err)
47+
return nil, errors.New(msg)
48+
}
49+
50+
i = alt
4751
}
4852

4953
return i, nil

0 commit comments

Comments
 (0)