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

Commit 1b51531

Browse files
author
thisisaaronland
committed
update to go-whosonfirst-sqlite-features v0.6.2; update cli tools to index geometry and properties tables
1 parent 650b158 commit 1b51531

File tree

11 files changed

+433
-8
lines changed

11 files changed

+433
-8
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Go package for indexing Who's On First features in SQLite databases.
77
### wof-sqlite-index-features
88

99
```
10+
$> ./bin/wof-sqlite-index-features -h
11+
Usage of ./bin/wof-sqlite-index-features:
1012
-all
1113
Index all tables (except the 'search' and 'geometries' tables which you need to specify explicitly)
1214
-ancestors
@@ -21,12 +23,14 @@ Go package for indexing Who's On First features in SQLite databases.
2123
Index the 'geojson' table
2224
-geometries
2325
Index the 'geometries' table (requires that libspatialite already be installed)
26+
-geometry
27+
Index the 'geometry' table
2428
-index-alt-files
2529
Index alt geometries
2630
-index-relations
2731
Index the records related to a feature, specifically wof:belongsto, wof:depicts and wof:involves. Alt files for relations are not indexed at this time.
2832
-index-relations-reader-uri string
29-
A valid go-reader.Reader URI from which to read data for a relations candidate.
33+
A valid go-reader.Reader URI from which to read data for a relations candidate.
3034
-live-hard-die-fast
3135
Enable various performance-related pragmas at the expense of possible (unlikely) database corruption (default true)
3236
-mode string
@@ -37,8 +41,10 @@ Go package for indexing Who's On First features in SQLite databases.
3741
Attempt to optimize the database before closing connection (default true)
3842
-processes int
3943
The number of concurrent processes to index data with (default 8)
44+
-properties
45+
Index the 'properties' table
4046
-rtree
41-
Index the 'rtree' table
47+
Index the 'rtree' table
4248
-search
4349
Index the 'search' table (using SQLite FTS4 full-text indexer)
4450
-spr

cmd/wof-sqlite-index-features/main.go

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ func main() {
4242
geometries := flag.Bool("geometries", false, "Index the 'geometries' table (requires that libspatialite already be installed)")
4343
names := flag.Bool("names", false, "Index the 'names' table")
4444
rtree := flag.Bool("rtree", false, "Index the 'rtree' table")
45+
geometry := flag.Bool("geometry", false, "Index the 'geometry' table")
46+
properties := flag.Bool("properties", false, "Index the 'properties' table")
4547
search := flag.Bool("search", false, "Index the 'search' table (using SQLite FTS4 full-text indexer)")
4648
spr := flag.Bool("spr", false, "Index the 'spr' table")
4749
live_hard := flag.Bool("live-hard-die-fast", true, "Enable various performance-related pragmas at the expense of possible (unlikely) database corruption")
@@ -145,6 +147,44 @@ func main() {
145147
to_index = append(to_index, gt)
146148
}
147149

150+
if *geometry || *all {
151+
152+
geometry_opts, err := tables.DefaultGeometryTableOptions()
153+
154+
if err != nil {
155+
logger.Fatal("failed to create 'geometry' table options because %s", err)
156+
}
157+
158+
geometry_opts.IndexAltFiles = *alt_files
159+
160+
gt, err := tables.NewGeometryTableWithDatabaseAndOptions(db, geometry_opts)
161+
162+
if err != nil {
163+
logger.Fatal("failed to create 'geometry' table because %s", err)
164+
}
165+
166+
to_index = append(to_index, gt)
167+
}
168+
169+
if *properties || *all {
170+
171+
properties_opts, err := tables.DefaultPropertiesTableOptions()
172+
173+
if err != nil {
174+
logger.Fatal("failed to create 'properties' table options because %s", err)
175+
}
176+
177+
properties_opts.IndexAltFiles = *alt_files
178+
179+
gt, err := tables.NewPropertiesTableWithDatabaseAndOptions(db, properties_opts)
180+
181+
if err != nil {
182+
logger.Fatal("failed to create 'properties' table because %s", err)
183+
}
184+
185+
to_index = append(to_index, gt)
186+
}
187+
148188
if *spr || *all {
149189

150190
spr_opts, err := tables.DefaultSPRTableOptions()
@@ -154,7 +194,7 @@ func main() {
154194
}
155195

156196
spr_opts.IndexAltFiles = *alt_files
157-
197+
158198
st, err := tables.NewSPRTableWithDatabaseAndOptions(db, spr_opts)
159199

160200
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/whosonfirst/go-whosonfirst-log v0.1.0
1414
github.com/whosonfirst/go-whosonfirst-reader v0.0.1
1515
github.com/whosonfirst/go-whosonfirst-sqlite v0.1.6
16-
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.5.0
16+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.2
1717
github.com/whosonfirst/go-whosonfirst-sqlite-index v0.2.0
1818
github.com/whosonfirst/warning v0.1.1
1919
)

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ github.com/whosonfirst/go-whosonfirst-sqlite-features v0.4.0 h1:hogsGiJCxzyHo7L+
241241
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.4.0/go.mod h1:FG3V5mkagABuTB5hOeLm1LKq80pSJpW67TdC4vNPMaY=
242242
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.5.0 h1:4i3I4vKtTEf493DrZOM7tqwL0dxi53/JRuIFrIWE8pg=
243243
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.5.0/go.mod h1:A964SQ/vZe/Yo0+AMGQMW55FYngGHQFXMgoewgOZXoY=
244+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.0 h1:48AFPCN1kUEF7nbTqEsPvauy4gRVBpk/0QSzIRv1epE=
245+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.0/go.mod h1:jZXXBBarIOYmkFl/LiKPjE4dQEunUZjV4fGqQImnXYQ=
246+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.1 h1:2F9503zBzinncf3Fox5w5NRygiZlx9CvfPeFCyAEwNk=
247+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.1/go.mod h1:jZXXBBarIOYmkFl/LiKPjE4dQEunUZjV4fGqQImnXYQ=
248+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.2 h1:7eWyeIwsHZTeMmSdmRVuj6X9bvjEUamE2caDrOZ0uXw=
249+
github.com/whosonfirst/go-whosonfirst-sqlite-features v0.6.2/go.mod h1:jZXXBBarIOYmkFl/LiKPjE4dQEunUZjV4fGqQImnXYQ=
244250
github.com/whosonfirst/go-whosonfirst-sqlite-index v0.0.1 h1:/GuAgxIHn5vZwAEDA4XUSWe7rYWZW30I4HLQRTpBeJY=
245251
github.com/whosonfirst/go-whosonfirst-sqlite-index v0.0.1/go.mod h1:5fY1ikCDhe1u0umawonTOICPzv/2CgfFT9hTAen5nsI=
246252
github.com/whosonfirst/go-whosonfirst-sqlite-index v0.1.0 h1:/tljUy2rchRC9XE4FDteNmYZYhYqxWX2uF4c61WlocU=

vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/README.md

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

vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/go.mod

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

vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/tables/geometry.go

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

0 commit comments

Comments
 (0)