Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whosonfirst/go-whosonfirst-iterate-sqlite
Go package implementing the `whosonfirst/go-whosonfirst-iterate/v2` interfaces for iterating (Who's On First) documents stored in a SQLite database.
https://github.com/whosonfirst/go-whosonfirst-iterate-sqlite
golang sqlite whosonfirst whosonfirst-iterate
Last synced: 1 day ago
JSON representation
Go package implementing the `whosonfirst/go-whosonfirst-iterate/v2` interfaces for iterating (Who's On First) documents stored in a SQLite database.
- Host: GitHub
- URL: https://github.com/whosonfirst/go-whosonfirst-iterate-sqlite
- Owner: whosonfirst
- License: bsd-3-clause
- Created: 2021-02-18T19:24:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-07T17:49:54.000Z (over 2 years ago)
- Last Synced: 2024-06-21T12:49:40.313Z (5 months ago)
- Topics: golang, sqlite, whosonfirst, whosonfirst-iterate
- Language: Go
- Homepage:
- Size: 26.2 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-whosonfirst-iterate-sqlite
Go package implementing go-whosonfirst-iterate/emitter functionality for (Who's On First specific) SQLite databases.
## Documentation
[![Go Reference](https://pkg.go.dev/badge/github.com/whosonfirst/go-whosonfirst-iterate-sqlite.svg)](https://pkg.go.dev/github.com/whosonfirst/go-whosonfirst-iterate-sqlite)
## Example
```
import (
"context"
"fmt"
"github.com/whosonfirst/go-whosonfirst-iterate/v2/iterator"
_ "github.com/whosonfirst/go-whosonfirst-iterate-sqlite/v2"
"io"
)func main() {
ctx := context.Background()
iter_cb := func(ctx context.Context, path string, r io.ReadSeeker, args ...interface{}) error {
fmt.Println(path)
return nil
}iter, _ := iterator.NewIterator(ctx, "sqlite://", iter_cb)
iter.IterateURIs(ctx, "whosonfirst.db")
}
```## Tools
```
$> make cli
go build -mod vendor -o bin/count cmd/count/main.go
go build -mod vendor -o bin/emit cmd/emit/main.go
```### count
```
$> ./bin/count /usr/local/data/sfomuseum-data-flights-2020-latest.db
2021/02/18 10:57:42 time to index paths (1) 1m46.893753865s
2021/02/18 10:57:42 Counted 752289 records (saw 752289 records)
```### emit
$> ./bin/emit \
-geojson \
-emitter-uri 'sqlite://?include=properties.icao:airline=ANZ' \
/usr/local/data/sfomuseum-data-flights-2020-latest.db| jq '.features[]["properties"]["wof:name"]'
```
"NZ9198 (SFO-IAH)"
"NZ9147 (BFL-SFO)"
"NZ9130 (EWR-SFO)"
"NZ9225 (SFO-LAS)"
"NZ9525 (SFO-MFR)"
"NZ9340 (SFO-PDX)"
"NZ9716 (SNA-SFO)"
"NZ9124 (EWR-SFO)"
"NZ9131 (MIA-SFO)"
"NZ9282 (LAX-SFO)"
"NZ9353 (PDX-SFO)"
"NZ9238 (LAS-SFO)
... and so on
```## See also
* https://github.com/whosonfirst/go-whosonfirst-iterate
* https://github.com/aaronland/go-sqlite