diff --git a/package-lock.json b/package-lock.json index 36d91f9b1..20ed4d5d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,7 @@ "opening_hours": "^3.6.0", "osm-auth": "^2.5.0", "osmtogeojson": "^3.0.0-beta.5", - "panoramax-js": "^0.3.8", + "panoramax-js": "^0.3.9", "panzoom": "^9.4.3", "papaparse": "^5.3.1", "pg": "^8.11.3", @@ -16009,9 +16009,9 @@ "license": "MIT" }, "node_modules/panoramax-js": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.3.8.tgz", - "integrity": "sha512-l8bUi+urcdqLjckGcEyDmYyAYCKjwFXpk/En7gpi5x32Nq2r9sHq7obX3Jbk1F7zH4rmpKbVtjS97cKEZr9zHQ==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.3.9.tgz", + "integrity": "sha512-CCXSmqwJxZYTxkru1LBAm2O+O/nnm3lwPX/8kLxYCIAZKQSFJsl1DoTkDqm/MLoo/dJOp3LmIVuK7nTM2NRgwA==", "dependencies": { "@ogcapi-js/features": "^1.1.1", "@ogcapi-js/shared": "^1.1.1", @@ -32104,9 +32104,9 @@ "version": "1.0.0" }, "panoramax-js": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.3.8.tgz", - "integrity": "sha512-l8bUi+urcdqLjckGcEyDmYyAYCKjwFXpk/En7gpi5x32Nq2r9sHq7obX3Jbk1F7zH4rmpKbVtjS97cKEZr9zHQ==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.3.9.tgz", + "integrity": "sha512-CCXSmqwJxZYTxkru1LBAm2O+O/nnm3lwPX/8kLxYCIAZKQSFJsl1DoTkDqm/MLoo/dJOp3LmIVuK7nTM2NRgwA==", "requires": { "@ogcapi-js/features": "^1.1.1", "@ogcapi-js/shared": "^1.1.1", diff --git a/package.json b/package.json index efc254cdd..b5e0fc883 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "opening_hours": "^3.6.0", "osm-auth": "^2.5.0", "osmtogeojson": "^3.0.0-beta.5", - "panoramax-js": "^0.3.8", + "panoramax-js": "^0.3.9", "panzoom": "^9.4.3", "papaparse": "^5.3.1", "pg": "^8.11.3", diff --git a/src/Logic/ImageProviders/Panoramax.ts b/src/Logic/ImageProviders/Panoramax.ts index 90996c5c7..6cd676096 100644 --- a/src/Logic/ImageProviders/Panoramax.ts +++ b/src/Logic/ImageProviders/Panoramax.ts @@ -10,13 +10,14 @@ import { Store, Stores, UIEventSource } from "../UIEventSource" import SvelteUIElement from "../../UI/Base/SvelteUIElement" import Panoramax_bw from "../../assets/svg/Panoramax_bw.svelte" import Link from "../../UI/Base/Link" +import { Utils } from "../../Utils" export default class PanoramaxImageProvider extends ImageProvider { public static readonly singleton = new PanoramaxImageProvider() private static readonly xyz = new PanoramaxXYZ() - private static defaultPanoramax = new AuthorizedPanoramax(Constants.panoramax.url, Constants.panoramax.token) + private static defaultPanoramax = new AuthorizedPanoramax(Constants.panoramax.url, Constants.panoramax.token, 3000) public defaultKeyPrefixes: string[] = ["panoramax"] public readonly name: string = "panoramax" @@ -137,9 +138,7 @@ export default class PanoramaxImageProvider extends ImageProvider { Stores.Chronic(1500, () => hasLoading(source.data), ).addCallback(_ => { - console.log("UPdating... ") super.getRelevantUrlsFor(tags, prefixes).then(data => { - console.log("New panoramax data is", data, hasLoading(data)) source.set(data) return !hasLoading(data) }) @@ -180,25 +179,33 @@ export class PanoramaxUploader implements ImageUploader { let hasDate = false let hasGPS = false + let [lon, lat] = currentGps + let datetime = new Date().toISOString() try { const tags = await ExifReader.load(blob) hasDate = tags?.DateTime !== undefined - hasGPS = tags?.GPSLatitude !== undefined && tags?.GPSLongitude !== undefined + 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() + + console.log("Tags are", tags) } catch (e) { console.error("Could not read EXIF-tags") } - let [lon, lat] = currentGps const p = this._panoramax const defaultSequence = (await p.mySequences())[0] + console.log("Upload options are", lon, lat, datetime) const img = await p.addImage(blob, defaultSequence, { - // It might seem odd that we set 'undefined' here - keep in mind that, by default, panoramax will use the EXIF-data - // We only pass variables as fallback! - lat: !hasGPS ? lat : undefined, - lon: !hasGPS ? lon : undefined, + lon: Utils.Round7(lon), + lat: Utils.Round7(lat), + datetime, isBlurred: noblur, - datetime: !hasDate ? new Date().toISOString() : undefined, exifOverride: { Artist: author, },