forked from MapComplete/MapComplete
		
	Fix: attempt to workaround for #2202
This commit is contained in:
		
							parent
							
								
									1b3687830c
								
							
						
					
					
						commit
						66465fdc98
					
				
					 2 changed files with 19 additions and 7 deletions
				
			
		|  | @ -23,11 +23,14 @@ export default class PanoramaxImageProvider extends ImageProvider { | ||||||
| 
 | 
 | ||||||
|     private static knownMeta: Record<string, { data: ImageData, time: Date }> = {} |     private static knownMeta: Record<string, { data: ImageData, time: Date }> = {} | ||||||
| 
 | 
 | ||||||
|     public SourceIcon(img?: { id: string, url: string, host?: string }, location?: { lon: number; lat: number; }): BaseUIElement { |     public SourceIcon(img?: { id: string, url: string, host?: string }, location?: { | ||||||
|  |         lon: number; | ||||||
|  |         lat: number; | ||||||
|  |     }): BaseUIElement { | ||||||
|         const p = new Panoramax(img.host) |         const p = new Panoramax(img.host) | ||||||
|         return new Link(new SvelteUIElement(Panoramax_bw), p.createViewLink({ |         return new Link(new SvelteUIElement(Panoramax_bw), p.createViewLink({ | ||||||
|             imageId: img?.id, |             imageId: img?.id, | ||||||
|             location |             location, | ||||||
|         }), true) |         }), true) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -173,15 +176,24 @@ export class PanoramaxUploader implements ImageUploader { | ||||||
|         absoluteUrl: string |         absoluteUrl: string | ||||||
|     }> { |     }> { | ||||||
| 
 | 
 | ||||||
|         const tags = await ExifReader.load(blob) |         let tags: ExifReader.Tags = undefined | ||||||
|         const hasDate = tags.DateTime !== undefined |         let hasDate = false | ||||||
|         const hasGPS = tags.GPSLatitude !== undefined && tags.GPSLongitude !== undefined |         let hasGPS = false | ||||||
|  |         try { | ||||||
|  |             const tags = await ExifReader.load(blob) | ||||||
|  |             hasDate  = tags?.DateTime !== undefined | ||||||
|  |             hasGPS = tags?.GPSLatitude !== undefined && tags?.GPSLongitude !== undefined | ||||||
|  |         } catch (e) { | ||||||
|  |             console.error("Could not read EXIF-tags") | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         const [lon, lat] = currentGps |         let [lon, lat] = currentGps | ||||||
| 
 | 
 | ||||||
|         const p = this._panoramax |         const p = this._panoramax | ||||||
|         const defaultSequence = (await p.mySequences())[0] |         const defaultSequence = (await p.mySequences())[0] | ||||||
|         const img = <ImageData>await p.addImage(blob, defaultSequence, { |         const img = <ImageData>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, |             lat: !hasGPS ? lat : undefined, | ||||||
|             lon: !hasGPS ? lon : undefined, |             lon: !hasGPS ? lon : undefined, | ||||||
|             datetime: !hasDate ? new Date().toISOString() : undefined, |             datetime: !hasDate ? new Date().toISOString() : undefined, | ||||||
|  |  | ||||||
|  | @ -1036,7 +1036,7 @@ export default class ThemeViewState implements SpecialVisualizationState { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (extramessage) { |         if (extramessage) { | ||||||
|             message += "(" + extramessage + ")" |             message += " (" + extramessage + ")" | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         const stacktrace: string = new Error().stack |         const stacktrace: string = new Error().stack | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue