diff --git a/internal/entity/photo_location.go b/internal/entity/photo_location.go index b33a6b343..08adfdda7 100644 --- a/internal/entity/photo_location.go +++ b/internal/entity/photo_location.go @@ -366,7 +366,7 @@ func (m *Photo) UpdateLocation() (keywords []string, labels classify.Labels) { // Empty or unknown S2 cell id... should not happen, unless coordinates are invalid. log.Warnf("photo: unknown cell id for lat %f, lng %f (uid %s)", m.PhotoLat, m.PhotoLng, m.PhotoUID) } else if err := loc.Find(GeoApi); err != nil { - log.Errorf("photo: %s (find location)", err) + log.Warnf("photo: %s (find location)", err) } else if loc.Place == nil { log.Warnf("photo: failed fetching geo data (uid %s, cell %s)", m.PhotoUID, loc.ID) } else if loc.ID != UnknownLocation.ID { diff --git a/internal/photoprism/index_mediafile.go b/internal/photoprism/index_mediafile.go index 1445a34dc..895002ebb 100644 --- a/internal/photoprism/index_mediafile.go +++ b/internal/photoprism/index_mediafile.go @@ -486,6 +486,15 @@ func (ind *Index) UserMediaFile(m *MediaFile, o IndexOptions, originalName, phot photo.SetCoordinates(data.Lat, data.Lng, data.Altitude, entity.SrcXmp) photo.SetCameraSerial(data.CameraSerial) + // Resolve the S2 cell when XMP provides GPS coordinates so subsequent + // re-indexes find the cell in the local DB and do not trigger a live + // geocoding request. + if data.Lat != 0 || data.Lng != 0 { + var locLabels classify.Labels + locKeywords, locLabels = photo.UpdateLocation() + labels = append(labels, locLabels...) + } + // Update metadata details. details.SetKeywords(data.Keywords.String(), entity.SrcXmp) details.SetNotes(data.Notes, entity.SrcXmp) diff --git a/internal/service/hub/places/cell.go b/internal/service/hub/places/cell.go index 9865bc0ea..e6cc411ca 100644 --- a/internal/service/hub/places/cell.go +++ b/internal/service/hub/places/cell.go @@ -62,7 +62,7 @@ func Cell(id string, locale string) (result Location, err error) { // Failed? if err != nil { - log.Errorf("places: location request to %s failed (%s)", serviceHost(reqUrl), safeError(err)) + log.Warnf("places: location request to %s failed (%s)", serviceHost(reqUrl), safeError(err)) return result, err } else if r == nil { err = fmt.Errorf("location request could not be performed")