You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 13, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-70Lines changed: 14 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,12 @@ Usage of ./bin/wof-sqlite-index-features:
38
38
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.
39
39
-index-relations-reader-uri string
40
40
A valid go-reader.Reader URI from which to read data for a relations candidate.
41
+
-iterator-uri string
42
+
A valid whosonfirst/go-whosonfirst-iterate/emitter URI. Supported emitter URI schemes are: directory://,featurecollection://,file://,filelist://,geojsonl://,repo:// (default "repo://")
41
43
-live-hard-die-fast
42
44
Enable various performance-related pragmas at the expense of possible (unlikely) database corruption (default true)
43
45
-mode string
44
-
The mode to use importing data. Valid modes are: directory://,featurecollection://,file://,filelist://,geojsonl://, metafile://, repo://, sqlite://. (default "repo://")
46
+
A valid whosonfirst/go-whosonfirst-iterate/emitter URI. Supported emitter URI schemes are: directory://,featurecollection://,file://,filelist://,geojsonl://,repo://. THIS FLAG IS DEPRECATED, please use -iterator-uri instead. (default "repo://")
45
47
-names
46
48
Index the 'names' table
47
49
-optimize
@@ -50,10 +52,6 @@ Usage of ./bin/wof-sqlite-index-features:
50
52
The number of concurrent processes to index data with (default 8)
51
53
-properties
52
54
Index the 'properties' table
53
-
-query value
54
-
One or more {PATH}={REGEXP} parameters for filtering records.
55
-
-query-mode string
56
-
Specify how query filtering should be evaluated. Valid modes are: ALL, ANY (default "ALL")
57
55
-rtree
58
56
Index the 'rtree' table
59
57
-search
@@ -62,6 +60,8 @@ Usage of ./bin/wof-sqlite-index-features:
62
60
Index the 'spr' table
63
61
-strict-alt-files
64
62
Be strict when indexing alt geometries (default true)
Or creating databases for all the Who's On First repos:
@@ -105,7 +105,7 @@ done
105
105
106
106
#### Inline queries
107
107
108
-
You can also specify inline queries by passing a `-query` parameter which is a string in the format of:
108
+
You can also specify inline queries by appending one or more `include` or `exclude` parameters to a `emitter.Emitter` URI, where the value is a string in the format of:
@@ -163,61 +158,16 @@ Enter ".help" for usage hints.
163
158
sqlite> SELECT id,name,placetype FROM spr;
164
159
85682065|New Brunswick|region
165
160
85682123|Newfoundland and Labrador|region
166
-
sqlite>
167
161
```
168
162
169
-
The default query mode is to ensure that all queries match but you can also specify that only one or more queries need to match by passing the `-query-mode ANY` flag:
163
+
The default query mode is to ensure that all queries match but you can also specify that only one or more queries need to match by appending a `include_mode` or `exclude_mode` parameter where the value is either "ANY" or "ALL".
170
164
171
165
#### SQLite performace-related PRAGMA
172
166
173
167
Note that the `-live-hard-die-fast` flag is enabled by default. That is to enable a number of performace-related PRAGMA commands (described [here](https://blog.devart.com/increasing-sqlite-performance.html) and [here](https://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/system.html)) without which database index can be prohibitive and time-consuming. These is a small but unlikely chance of database corruptions when this flag is enabled.
174
168
175
169
Also note that the `-live-hard-die-fast` flag will cause the `PAGE_SIZE` and `CACHE_SIZE` PRAGMAs to be set to `4096` and `1000000` respectively so the eventual cache size will require 4GB of memory. This is probably fine on most systems where you'll be indexing data but I am open to the idea that we may need to revisit those numbers or at least make them configurable.
176
170
177
-
### wof-sqlite-query-features
178
-
179
-
Query a search-enabled SQLite database by name(s). Results are output as CSV encoded rows containing `id` and `(wof:)name` properties.
180
-
181
-
_This assumes you have created the database using the `wof-sqlite-index-features` tool with the `-search` paramter._
182
-
183
-
```
184
-
$> ./bin/wof-sqlite-query-features -h
185
-
Usage of ./bin/wof-sqlite-query-features:
186
-
-column string
187
-
The 'names_*' column to query against. Valid columns are: names_all, names_preferred, names_variant, names_colloquial. (default "names_all")
188
-
-driver string
189
-
(default "sqlite3")
190
-
-dsn string
191
-
(default ":memory:")
192
-
-is-ceased string
193
-
A comma-separated list of valid existential flags (-1,0,1) to filter results according to whether or not they have been marked as ceased. Multiple flags are evaluated as a nested 'OR' query.
194
-
-is-current string
195
-
A comma-separated list of valid existential flags (-1,0,1) to filter results according to their 'mz:is_current' property. Multiple flags are evaluated as a nested 'OR' query.
196
-
-is-deprecated string
197
-
A comma-separated list of valid existential flags (-1,0,1) to filter results according to whether or not they have been marked as deprecated. Multiple flags are evaluated as a nested 'OR' query.
198
-
-is-superseded string
199
-
A comma-separated list of valid existential flags (-1,0,1) to filter results according to whether or not they have been marked as superseded. Multiple flags are evaluated as a nested 'OR' query.
200
-
-output string
201
-
A valid path to write (CSV) results to. If empty results are written to STDOUT.
202
-
-table string
203
-
The name of the SQLite table to query against. (default "search")
$> ./bin/wof-sqlite-query-features -dsn test2.db -column names_colloquial Paris
213
-
85922583,San Francisco
214
-
102027181,Shanghai
215
-
102030585,Kolkata
216
-
101751929,Tromsø
217
-
```
218
-
219
-
Full-text search is supported using SQLite's FTS4 indexer. In order to index the `search` table you must explicitly pass the `-search` flag to the `wof-sqlite-index-features` command. It is _not_ included when you set the `-all` flag (which should probably be renamed to be `-common` but that's not the case today...) because it increases the overall indexing time by a non-trivial amount.
As of this writing individual tables are indexed atomically. There may be some improvements to be made indexing tables in separate Go routines but my hunch is this will make SQLite sad and cause a lot of table lock errors. I don't need to be right about that, though...
342
288
343
-
## Dependencies and relationships
344
-
345
-
These are documented in the [Dependencies and relationships section](https://github.com/whosonfirst/go-whosonfirst-sqlite#dependencies-and-relationships) of the `go-whosonfirst-sqlite` package.
0 commit comments