forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
e33d448055
commit
d2134668b1
25 changed files with 109 additions and 171 deletions
|
|
@ -190,7 +190,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
|||
provider: "panoramax",
|
||||
direction: imageData.properties["view:azimuth"],
|
||||
osmTags: {
|
||||
panoramax: imageData.id
|
||||
panoramax: imageData.id,
|
||||
},
|
||||
thumbUrl: imageData.assets.thumb.href,
|
||||
date: new Date(imageData.properties.datetime).getTime(),
|
||||
|
|
@ -199,22 +199,26 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
|||
detailsUrl: imageData.id,
|
||||
details: {
|
||||
isSpherical:
|
||||
imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular"
|
||||
}
|
||||
imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
public async fetchImages(lat: number, lon: number): Promise<P4CPicture[]> {
|
||||
const radiusSettings = [{
|
||||
place_fov_tolerance: 180,
|
||||
radius: 15
|
||||
}, {
|
||||
place_fov_tolerance: 180,
|
||||
radius: 25
|
||||
}, {
|
||||
place_fov_tolerance: 90,
|
||||
radius: 50
|
||||
}]
|
||||
const radiusSettings = [
|
||||
{
|
||||
place_fov_tolerance: 180,
|
||||
radius: 15,
|
||||
},
|
||||
{
|
||||
place_fov_tolerance: 180,
|
||||
radius: 25,
|
||||
},
|
||||
{
|
||||
place_fov_tolerance: 90,
|
||||
radius: 50,
|
||||
},
|
||||
]
|
||||
const promises: Promise<ImageData[]>[] = []
|
||||
const maxRadius = this._radius
|
||||
let prevRadius = 0
|
||||
|
|
@ -223,7 +227,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
|||
place: [lon, lat],
|
||||
place_distance: [prevRadius, Math.min(maxRadius, radiusSetting.radius)],
|
||||
place_fov_tolerance: radiusSetting.place_fov_tolerance,
|
||||
limit: 50
|
||||
limit: 50,
|
||||
})
|
||||
promises.push(promise)
|
||||
prevRadius = radiusSetting.radius
|
||||
|
|
|
|||
|
|
@ -16,15 +16,23 @@ export default class PlantNet {
|
|||
url += "&images=" + encodeURIComponent(image)
|
||||
}
|
||||
|
||||
const result = await Utils.downloadJsonCachedAdvanced(url, 365 * 24 * 60 * 60 * 1000, undefined, true, 1)
|
||||
const result = await Utils.downloadJsonCachedAdvanced(
|
||||
url,
|
||||
365 * 24 * 60 * 60 * 1000,
|
||||
undefined,
|
||||
true,
|
||||
1
|
||||
)
|
||||
if (result["content"]) {
|
||||
return result["content"]
|
||||
}
|
||||
const errResult = <{
|
||||
"statusCode": 404,
|
||||
"error": "Not Found",
|
||||
"message": "Species not found" | string
|
||||
}>JSON.parse(result["errContent"])
|
||||
const errResult = <
|
||||
{
|
||||
statusCode: 404
|
||||
error: "Not Found"
|
||||
message: "Species not found" | string
|
||||
}
|
||||
>JSON.parse(result["errContent"])
|
||||
if (errResult.message === "Species not found") {
|
||||
return "no_plant_detected"
|
||||
}
|
||||
|
|
@ -32,7 +40,6 @@ export default class PlantNet {
|
|||
console.log("Get error result:", err, ">>>>", result["errContent"])
|
||||
throw err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface PlantNetSpeciesMatch {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,14 @@ export default class ThemeViewStateHashActor {
|
|||
if (found.properties.id.startsWith("last_click")) {
|
||||
return true
|
||||
}
|
||||
console.log("Setting selected element based on hash", hash, "; found", found, "current:", selectedElement.data?.properties?.id)
|
||||
console.log(
|
||||
"Setting selected element based on hash",
|
||||
hash,
|
||||
"; found",
|
||||
found,
|
||||
"current:",
|
||||
selectedElement.data?.properties?.id
|
||||
)
|
||||
selectedElement.setData(found)
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue