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

Commit 259f1da

Browse files
author
thisisaaronland
committed
ensure IsPrincipalWOFRecord
1 parent 44c4a72 commit 259f1da

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

index.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"github.com/whosonfirst/go-whosonfirst-geojson-v2/feature"
88
wof_index "github.com/whosonfirst/go-whosonfirst-index"
9+
wof_utils "github.com/whosonfirst/go-whosonfirst-index/utils"
910
"github.com/whosonfirst/go-whosonfirst-sqlite"
1011
sql_index "github.com/whosonfirst/go-whosonfirst-sqlite-index"
1112
"github.com/whosonfirst/warning"
@@ -22,12 +23,26 @@ func NewDefaultSQLiteFeaturesIndexer(db sqlite.Database, to_index []sqlite.Table
2223
case <-ctx.Done():
2324
return nil, nil
2425
default:
26+
2527
path, err := wof_index.PathForContext(ctx)
2628

2729
if err != nil {
2830
return nil, err
2931
}
3032

33+
// skip alt files - see below for details
34+
// (20190821/thisisaaronland)
35+
36+
ok, err := wof_utils.IsPrincipalWOFRecord(fh, ctx)
37+
38+
if err != nil {
39+
return nil, err
40+
}
41+
42+
if !ok {
43+
return nil, nil
44+
}
45+
3146
closer := ioutil.NopCloser(fh)
3247

3348
i, err := feature.LoadWOFFeatureFromReader(closer)

vendor/github.com/whosonfirst/go-whosonfirst-index/utils/utils.go

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ github.com/whosonfirst/go-whosonfirst-geojson-v2/utils
4040
github.com/whosonfirst/go-whosonfirst-hash
4141
# github.com/whosonfirst/go-whosonfirst-index v0.1.2
4242
github.com/whosonfirst/go-whosonfirst-index
43+
github.com/whosonfirst/go-whosonfirst-index/utils
4344
# github.com/whosonfirst/go-whosonfirst-log v0.1.0
4445
github.com/whosonfirst/go-whosonfirst-log
4546
# github.com/whosonfirst/go-whosonfirst-names v0.1.0

0 commit comments

Comments
 (0)