forked from MapComplete/MapComplete
Chore: improve typing
This commit is contained in:
parent
d01f830632
commit
01f1fbf89a
5 changed files with 38 additions and 14 deletions
|
@ -16,7 +16,7 @@ export class Mapillary extends ImageProvider {
|
|||
"http://mapillary.com",
|
||||
"https://mapillary.com",
|
||||
"http://www.mapillary.com",
|
||||
"https://www.mapillary.com",
|
||||
"https://www.mapillary.com"
|
||||
]
|
||||
defaultKeyPrefixes = ["mapillary", "image"]
|
||||
|
||||
|
@ -69,7 +69,7 @@ export class Mapillary extends ImageProvider {
|
|||
lat: location?.lat,
|
||||
lng: location?.lon,
|
||||
z: location === undefined ? undefined : Math.max((zoom ?? 2) - 1, 1),
|
||||
pKey,
|
||||
pKey
|
||||
}
|
||||
const baselink = `https://www.mapillary.com/app/?`
|
||||
const paramsStr = Utils.NoNull(
|
||||
|
@ -82,6 +82,8 @@ export class Mapillary extends ImageProvider {
|
|||
|
||||
/**
|
||||
* Returns the correct key for API v4.0
|
||||
*
|
||||
* Mapillary.ExtractKeyFromURL("999924810651016") // => 999924810651016
|
||||
*/
|
||||
private static ExtractKeyFromURL(value: string): number {
|
||||
let key: string
|
||||
|
@ -144,7 +146,9 @@ export class Mapillary extends ImageProvider {
|
|||
mapillaryId +
|
||||
"?fields=thumb_1024_url,thumb_original_url,captured_at,creator&access_token=" +
|
||||
Constants.mapillary_client_token_v4
|
||||
const response = await Utils.downloadJsonCached(metadataUrl, 60 * 60)
|
||||
const response = await Utils.downloadJsonCached<{
|
||||
thumb_1024_url: string, thumb_original_url: string, captured_at, creator: string
|
||||
}>(metadataUrl, 60 * 60)
|
||||
|
||||
const license = new LicenseInfo()
|
||||
license.artist = response["creator"]["username"]
|
||||
|
@ -164,9 +168,13 @@ 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&access_token=" +
|
||||
"?fields=thumb_1024_url,thumb_original_url,captured_at,compass_angle,geometry,creator,camera_type&access_token=" +
|
||||
Constants.mapillary_client_token_v4
|
||||
const response = await Utils.downloadJsonCached(metadataUrl, 60 * 60)
|
||||
const response = await Utils.downloadJsonCached<{
|
||||
thumb_1024_url: string, thumb_original_url: string, captured_at,
|
||||
compass_angle: number,
|
||||
creator: string
|
||||
}>(metadataUrl, 60 * 60)
|
||||
const url = <string>response["thumb_1024_url"]
|
||||
const url_hd = <string>response["thumb_original_url"]
|
||||
const date = new Date()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue