forked from MapComplete/MapComplete
Fix #1863
This commit is contained in:
parent
a79675c879
commit
940f187041
8 changed files with 37 additions and 22 deletions
|
@ -133,12 +133,21 @@ export class Mapillary extends ImageProvider {
|
|||
return [this.PrepareUrlAsync(key, value)]
|
||||
}
|
||||
|
||||
public async DownloadAttribution(_: string): Promise<LicenseInfo> {
|
||||
public async DownloadAttribution(providedImage: ProvidedImage): Promise<LicenseInfo> {
|
||||
const mapillaryId = providedImage.id
|
||||
const metadataUrl =
|
||||
"https://graph.mapillary.com/" +
|
||||
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 license = new LicenseInfo()
|
||||
license.artist = undefined
|
||||
license.artist = response["creator"]["username"]
|
||||
license.license = "CC BY-SA 4.0"
|
||||
// license.license = "Creative Commons Attribution-ShareAlike 4.0 International License";
|
||||
license.attributionRequired = true
|
||||
license.date = new Date(response["captured_at"])
|
||||
return license
|
||||
}
|
||||
|
||||
|
@ -151,16 +160,19 @@ export class Mapillary extends ImageProvider {
|
|||
const metadataUrl =
|
||||
"https://graph.mapillary.com/" +
|
||||
mapillaryId +
|
||||
"?fields=thumb_1024_url,thumb_original_url&access_token=" +
|
||||
"?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 url = <string>response["thumb_1024_url"]
|
||||
const url_hd = <string>response["thumb_original_url"]
|
||||
return {
|
||||
const date = new Date()
|
||||
date.setTime(response["captured_at"])
|
||||
return <ProvidedImage> {
|
||||
id: "" + mapillaryId,
|
||||
url,
|
||||
url_hd,
|
||||
provider: this,
|
||||
date,
|
||||
key,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue