Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-11-01 14:16:46 +01:00
commit b99a857edc
124 changed files with 1731 additions and 921 deletions

View file

@ -10,6 +10,7 @@ import Translations from "../../UI/i18n/Translations"
import { Translation } from "../../UI/i18n/Translation"
import { IndexedFeatureSource } from "../FeatureSource/FeatureSource"
import { GeoOperations } from "../GeoOperations"
import { Feature } from "geojson"
/**
* The ImageUploadManager has a
@ -155,7 +156,8 @@ export class ImageUploadManager {
author: string,
blob: File,
targetKey: string | undefined,
noblur: boolean
noblur: boolean,
feature?: Feature
): Promise<UploadResult> {
this.increaseCountFor(this._uploadStarted, featureId)
let key: string
@ -166,7 +168,7 @@ export class ImageUploadManager {
location = [this._gps.data.longitude, this._gps.data.latitude]
}
if (location === undefined || location?.some((l) => l === undefined)) {
const feature = this._indexedFeatures.featuresById.data.get(featureId)
feature ??= this._indexedFeatures.featuresById.data.get(featureId)
location = GeoOperations.centerpointCoordinates(feature)
}
try {

View file

@ -197,8 +197,15 @@ export class PanoramaxUploader implements ImageUploader {
let datetime = new Date().toISOString()
try {
const tags = await ExifReader.load(blob)
lat = Number(tags?.GPSLatitude?.description)
lon = Number(tags?.GPSLongitude?.description)
const [[latD], [latM], [latS, latSDenom]] = <
[[number, number], [number, number], [number, number]]
>tags?.GPSLatitude.value
const [[lonD], [lonM], [lonS, lonSDenom]] = <
[[number, number], [number, number], [number, number]]
>tags?.GPSLongitude.value
lat = latD + latM / 60 + latS / (3600 * latSDenom)
lon = lonD + lonM / 60 + lonS / (3600 * lonSDenom)
const [date, time] = tags.DateTime.value[0].split(" ")
datetime = new Date(date.replaceAll(":", "-") + "T" + time).toISOString()