Skip to content

Commit

Permalink
Replace rgeo with tinygpkg (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmilyOrg committed Oct 9, 2023
2 parents 013ee69 + 30f69b4 commit ea4b967
Show file tree
Hide file tree
Showing 20 changed files with 468 additions and 144 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
with:
node-version: '16'

- name: Install just
uses: extractions/setup-just@v1

- name: Download assets
run: just assets

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ builds:
goarch: "386"
tags:
- embedstatic
- embedgeo
dockers:
- dockerfile: Dockerfile-goreleaser
image_templates:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ COPY internal ./internal
COPY io ./io
COPY db ./db
COPY fonts ./fonts
COPY data/geo ./data/geo
# RUN go install -tags libjpeg .
COPY --from=node-builder /ui/dist/ ./ui/dist
RUN go install -tags embedstatic .
RUN go install -tags embedstatic,embedgeo .



Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ layouts.
* [ ] **Face recognition**. Photos could be automatically tagged with the
person's name. This would be a great way to search for photos of a specific
person.
* **Reverse geolocation**. Local, embedded reverse geolocation via [tinygpkg].
Does not need any API calls, has negligible performance impact, and supports
~50 thousand places. Currently only supported for photos with GPS coordinates
in the EXIF data and the Timeline view.



Persistent photo
selection is also implemented using tags. Tags are
* **Flexible media/thumbnail system**. Do you have hundreds of gigabytes of existing
thumbnails from an existing system? Me too! Let's reuse those. Don't have any?
No worries, they will be generated automatically to speed up display. Here are
Expand Down Expand Up @@ -383,6 +383,8 @@ Distributed under the MIT License. See `LICENSE` for more information.

## Acknowledgements
* [Open Images Dataset][open-images-dataset]
* [geoBoundaries](https://www.geoboundaries.org/) for geographic boundary data used for reverse geolocation
* [sams96/rgeo](https://github.com/sams96/rgeo) for previous reverse geolocation implementation and inspiration
* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)
* [readme.so](https://readme.so/)

Expand All @@ -409,3 +411,4 @@ Distributed under the MIT License. See `LICENSE` for more information.
[Vue 3]: https://v3.vuejs.org/
[BalmUI]: https://next-material.balmjs.com/
[photofield-ai]: https://github.com/smilyorg/photofield-ai
[tinygpkg]: https://github.com/smilyorg/tinygpkg
24 changes: 23 additions & 1 deletion defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,29 @@ geo:
# Can delay startup by up to a minute as the local geolocation
# database is loaded.
#
# reverse_geocode: true
reverse_geocode: true
geopackage:
# Path to the GeoPackage file containing features
# WKB and TWKB (via tinygpkg) are supported.
#
# See https://github.com/SmilyOrg/tinygpkg-data
#
# If empty, the database embedded into the executable
# via embed-geo.go is used.
#
# path: data/geo/geoBoundariesCGAZ_ADM2_s5_twkb_p3.gpkg

# Table in the GeoPackage file to be used in case there is
# more than one
#
# If empty, the first table is used.
#
# table: globalADM2

# The column to use for reverse geocoding the location name
name_col: shapeName # geoBoundaries CGAZ
# name_col: name_conve # Natural Earth urban areas
# name_col: NAME_LONG # Natural Earth countries

media:
# Extract metadata from this many files concurrently
Expand Down
30 changes: 21 additions & 9 deletions docker/grafana/dashboards/photofield.json
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "yellow",
Expand Down Expand Up @@ -1540,7 +1541,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "#EAB839",
Expand Down Expand Up @@ -1606,7 +1608,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
}
]
},
Expand Down Expand Up @@ -1682,7 +1685,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "#EAB839",
Expand Down Expand Up @@ -1759,7 +1763,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "#EAB839",
Expand Down Expand Up @@ -1829,7 +1834,8 @@
"mode": "absolute",
"steps": [
{
"color": "text"
"color": "text",
"value": null
},
{
"color": "green",
Expand Down Expand Up @@ -1913,7 +1919,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
}
]
},
Expand Down Expand Up @@ -2526,9 +2533,14 @@
"selected": false,
"text": "path",
"value": "path"
},
{
"selected": false,
"text": "geometry",
"value": "geometry"
}
],
"query": "scene,image,image_info,path",
"query": "scene,image,image_info,path,geometry",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
Expand Down Expand Up @@ -2674,6 +2686,6 @@
"timezone": "",
"title": "Photofield",
"uid": "9sQ5hGGnk",
"version": 24,
"version": 29,
"weekStart": ""
}
8 changes: 8 additions & 0 deletions embed-geo-stub.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !embedgeo
// +build !embedgeo

package main

import "embed"

var GeoFs embed.FS
10 changes: 10 additions & 0 deletions embed-geo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build embedgeo
// +build embedgeo

package main

import "embed"

// tinygpkg-data release: v0.2.0
//go:embed data/geo/geoBoundariesCGAZ_ADM2_s5_twkb_p3.gpkg
var GeoFs embed.FS
File renamed without changes.
File renamed without changes.
38 changes: 20 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ require (
github.com/go-chi/render v1.0.1
github.com/goccy/go-yaml v1.7.17
github.com/golang-migrate/migrate/v4 v4.15.0-beta.1
github.com/golang/geo v0.0.0-20200730024412-e86565bf3f35
github.com/golang/geo v0.0.0-20230421003525-6adc56603217
github.com/gosimple/slug v1.10.0
github.com/grafana/pyroscope-go v1.0.4
github.com/hako/durafmt v0.0.0-20200605151348-3a43fc422dd9
github.com/imdario/mergo v0.3.13
github.com/joho/godotenv v1.3.0
Expand All @@ -26,18 +27,19 @@ require (
github.com/matoous/go-nanoid/v2 v2.0.0
github.com/mostlygeek/go-exiftool v0.0.0-20190130212521-a0e5de16f760
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9
github.com/peterstace/simplefeatures v0.44.0
github.com/pixiv/go-libjpeg v0.0.0-20190822045933-3da21a74767d
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.0
github.com/pyroscope-io/client v0.7.0
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
github.com/sams96/rgeo v1.2.0
github.com/sheerun/queue v1.0.1
github.com/smilyorg/tinygpkg v0.2.0
github.com/tdewolff/canvas v0.0.0-20200504121106-e2600b35c365
github.com/x448/float16 v0.8.4
golang.org/x/image v0.0.0-20191214001246-9130b4cfad52
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
zombiezen.com/go/sqlite v0.10.1
golang.org/x/sync v0.1.0
modernc.org/sqlite v1.21.1
zombiezen.com/go/sqlite v0.13.0
)

require (
Expand All @@ -49,51 +51,51 @@ require (
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/gddo v0.0.0-20210115222349-20d68f94ee1f // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 // indirect
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gosimple/unidecode v1.0.0 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.4 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/oliamb/cutter v0.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/pyroscope-io/godeltaprof v0.1.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/tdewolff/minify/v2 v2.7.1-0.20200112204046-70870d25a935 // indirect
github.com/tdewolff/parse/v2 v2.4.2 // indirect
github.com/twpayne/go-geom v1.4.4 // indirect
github.com/wcharczuk/go-chart v2.0.2-0.20191206192251-962b9abdec2b+incompatible // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.2 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gonum.org/v1/plot v0.0.0-20190410204940-3a5f52653745 // indirect
google.golang.org/protobuf v1.26.0 // indirect
lukechampine.com/uint128 v1.1.1 // indirect
modernc.org/cc/v3 v3.38.1 // indirect
modernc.org/ccgo/v3 v3.16.9 // indirect
modernc.org/libc v1.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.22.3 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.4.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.19.1 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
)
Loading

0 comments on commit ea4b967

Please sign in to comment.