forked from MapComplete/MapComplete
Feature(360): actually show spheres when it is already linked
This commit is contained in:
parent
3e4708b0b9
commit
e81b0d10ea
17 changed files with 124 additions and 30 deletions
|
@ -204,19 +204,24 @@ export class Mapillary extends ImageProvider {
|
|||
const metadataUrl =
|
||||
"https://graph.mapillary.com/" +
|
||||
mapillaryId +
|
||||
"?fields=thumb_1024_url,thumb_original_url,captured_at,compass_angle,geometry,creator,camera_type&access_token=" +
|
||||
"?fields=thumb_1024_url,thumb_original_url,captured_at,compass_angle,geometry,computed_geometry,creator,camera_type&access_token=" +
|
||||
Constants.mapillary_client_token_v4
|
||||
const response = await Utils.downloadJsonCached<{
|
||||
thumb_1024_url: string, thumb_original_url: string, captured_at,
|
||||
thumb_1024_url: string,
|
||||
thumb_original_url: string,
|
||||
captured_at,
|
||||
compass_angle: number,
|
||||
creator: string
|
||||
creator: string,
|
||||
computed_geometry: Point,
|
||||
geometry: Point,
|
||||
camera_type: "equirectangular" | "spherical" | string
|
||||
}>(metadataUrl, 60 * 60)
|
||||
const url = <string>response["thumb_1024_url"]
|
||||
const url_hd = <string>response["thumb_original_url"]
|
||||
const date = new Date()
|
||||
const rotation = (720 - Number(response["compass_angle"])) % 360
|
||||
const geometry = response["geometry"]
|
||||
date.setTime(response["captured_at"])
|
||||
const rotation: number = (720 - Number(response.compass_angle)) % 360
|
||||
const geometry: Point = response.computed_geometry ?? response.geometry
|
||||
date.setTime(response.captured_at)
|
||||
return <ProvidedImage>{
|
||||
id: "" + mapillaryId,
|
||||
url,
|
||||
|
@ -225,6 +230,7 @@ export class Mapillary extends ImageProvider {
|
|||
date,
|
||||
key,
|
||||
rotation,
|
||||
isSpherical: response.camera_type === "spherical" || response.camera_type === "equirectangular",
|
||||
lat: geometry.coordinates[1],
|
||||
lon: geometry.coordinates[0]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue