diff options
author | 2022-02-12 18:27:58 +0000 | |
---|---|---|
committer | 2022-02-12 18:27:58 +0000 | |
commit | 31935ee206107f077878d3cdb6a26b82436b6893 (patch) | |
tree | 2d522bf98013dc5a4539133561b645fd7457eb06 /vendor/github.com/dsoprea/go-exif/gps.go | |
parent | [chore] Add nightly mirror to Codeberg.org (#392) (diff) | |
parent | Go mod tidy (diff) | |
download | gotosocial-31935ee206107f077878d3cdb6a26b82436b6893.tar.xz |
Merge pull request #361 from superseriousbusiness/media_refactorv0.2.0
Refactor media handler to allow async media resolution
Diffstat (limited to 'vendor/github.com/dsoprea/go-exif/gps.go')
-rw-r--r-- | vendor/github.com/dsoprea/go-exif/gps.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/vendor/github.com/dsoprea/go-exif/gps.go b/vendor/github.com/dsoprea/go-exif/gps.go deleted file mode 100644 index 7d74f22d3..000000000 --- a/vendor/github.com/dsoprea/go-exif/gps.go +++ /dev/null @@ -1,56 +0,0 @@ -package exif - -import ( - "errors" - "fmt" - "time" - - "github.com/golang/geo/s2" -) - -var ( - ErrGpsCoordinatesNotValid = errors.New("GPS coordinates not valid") -) - -type GpsDegrees struct { - Orientation byte - Degrees, Minutes, Seconds float64 -} - -func (d GpsDegrees) String() string { - return fmt.Sprintf("Degrees<O=[%s] D=(%g) M=(%g) S=(%g)>", string([]byte{d.Orientation}), d.Degrees, d.Minutes, d.Seconds) -} - -func (d GpsDegrees) Decimal() float64 { - decimal := float64(d.Degrees) + float64(d.Minutes)/60.0 + float64(d.Seconds)/3600.0 - - if d.Orientation == 'S' || d.Orientation == 'W' { - return -decimal - } else { - return decimal - } -} - -type GpsInfo struct { - Latitude, Longitude GpsDegrees - Altitude int - Timestamp time.Time -} - -func (gi *GpsInfo) String() string { - return fmt.Sprintf("GpsInfo<LAT=(%.05f) LON=(%.05f) ALT=(%d) TIME=[%s]>", gi.Latitude.Decimal(), gi.Longitude.Decimal(), gi.Altitude, gi.Timestamp) -} - -func (gi *GpsInfo) S2CellId() s2.CellID { - latitude := gi.Latitude.Decimal() - longitude := gi.Longitude.Decimal() - - ll := s2.LatLngFromDegrees(latitude, longitude) - cellId := s2.CellIDFromLatLng(ll) - - if cellId.IsValid() == false { - panic(ErrGpsCoordinatesNotValid) - } - - return cellId -} |