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
|
@ -211,7 +211,6 @@ The question is `What is the corresponding Wikidata entity?`
|
||||||
The question is `What does this artwork depict?`
|
The question is `What does this artwork depict?`
|
||||||
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
||||||
|
|
||||||
This tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
|
|
||||||
This tagrendering has labels
|
This tagrendering has labels
|
||||||
`artwork-question`
|
`artwork-question`
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,6 @@ The question is `What is the corresponding Wikidata entity?`
|
||||||
The question is `What does this artwork depict?`
|
The question is `What does this artwork depict?`
|
||||||
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
||||||
|
|
||||||
This tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
|
|
||||||
This tagrendering has labels
|
This tagrendering has labels
|
||||||
`artwork-question`
|
`artwork-question`
|
||||||
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
[//]: # (WARNING: this file is automatically generated. Please find the sources at the bottom and edit those sources)
|
|
||||||
|
|
||||||
# crab_address
|
|
||||||
|
|
||||||
Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override. Note that HNRLABEL contains the original value, whereas _HNRLABEL contains a slightly cleaned version
|
|
||||||
|
|
||||||
- This layer is shown at zoomlevel **0** and higher
|
|
||||||
- <img src='../warning.svg' height='1rem'/>
|
|
||||||
|
|
||||||
This layer is loaded from an external source, namely
|
|
||||||
|
|
||||||
`https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/CRAB_2021_10_26/tile_{z}_{x}_{y}.geojson`
|
|
||||||
|
|
||||||
## Table of contents
|
|
||||||
|
|
||||||
1. [Themes using this layer](#themes-using-this-layer)
|
|
||||||
2. [Basic tags for this layer](#basic-tags-for-this-layer)
|
|
||||||
3. [Supported attributes](#supported-attributes)
|
|
||||||
4. [Featureview elements and TagRenderings](#featureview-elements-and-tagrenderings)
|
|
||||||
- [render_crab](#render_crab)
|
|
||||||
- [leftover-questions](#leftover-questions)
|
|
||||||
- [lod](#lod)
|
|
||||||
|
|
||||||
## Themes using this layer
|
|
||||||
|
|
||||||
- [grb](https://mapcomplete.org/grb)
|
|
||||||
|
|
||||||
## Basic tags for this layer
|
|
||||||
|
|
||||||
Elements must match the expression **HUISNR~.+**
|
|
||||||
|
|
||||||
[Execute on overpass](http://overpass-turbo.eu/?Q=%5Bout%3Ajson%5D%5Btimeout%3A90%5D%3B%28%20%20%20%20nwr%5B%22HUISNR%22%5D%28%7B%7Bbbox%7D%7D%29%3B%0A%29%3Bout%20body%3B%3E%3Bout%20skel%20qt%3B)
|
|
||||||
|
|
||||||
## Supported attributes
|
|
||||||
|
|
||||||
## Featureview elements and TagRenderings
|
|
||||||
|
|
||||||
| id | question | labels | freeform key |
|
|
||||||
-----|-----|-----|----- |
|
|
||||||
| [render_crab](#render_crab) | _Volgens het CRAB ligt hier <b>{STRAATNM}</b> {HUISNR} (label: {HNRLABEL})_ | | _Multiple choice only_ |
|
|
||||||
| [leftover-questions](#leftover-questions) | _{questions( ,hidden)}_ | ignore-docs, added_by_default | _Multiple choice only_ |
|
|
||||||
| [lod](#lod) <br/> _(Original in [questions](./BuiltinQuestions.md#lod))_ | _{linked_data_from_website()}_ | added_by_default | _Multiple choice only_ |
|
|
||||||
|
|
||||||
### render_crab
|
|
||||||
|
|
||||||
_This tagrendering has no question and is thus read-only_
|
|
||||||
*Volgens het CRAB ligt hier <b>{STRAATNM}</b> {HUISNR} (label: {HNRLABEL})*
|
|
||||||
|
|
||||||
### leftover-questions
|
|
||||||
|
|
||||||
_This tagrendering has no question and is thus read-only_
|
|
||||||
*{questions( ,hidden)}*
|
|
||||||
|
|
||||||
This tagrendering has labels
|
|
||||||
`ignore-docs`
|
|
||||||
`added_by_default`
|
|
||||||
|
|
||||||
### lod
|
|
||||||
|
|
||||||
_This tagrendering has no question and is thus read-only_
|
|
||||||
*{linked_data_from_website()}*
|
|
||||||
|
|
||||||
This tagrendering has labels
|
|
||||||
`added_by_default`
|
|
||||||
|
|
||||||
|
|
||||||
This document is autogenerated from [assets/layers/crab_address/crab_address.json](https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/assets/layers/crab_address/crab_address.json)
|
|
|
@ -418,7 +418,6 @@ The question is `What is the corresponding Wikidata entity?`
|
||||||
The question is `What does this artwork depict?`
|
The question is `What does this artwork depict?`
|
||||||
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
*This artwork depicts {wikidata_label(subject:wikidata)}{wikipedia(subject:wikidata)}* is shown if `subject:wikidata` is set
|
||||||
|
|
||||||
This tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
|
|
||||||
This tagrendering has labels
|
This tagrendering has labels
|
||||||
`artwork-question`
|
`artwork-question`
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ This theme contains the following layers:
|
||||||
- [service_ways (defined in this theme)](#service_ways)
|
- [service_ways (defined in this theme)](#service_ways)
|
||||||
- [generic_osm_object (defined in this theme)](#generic_osm_object)
|
- [generic_osm_object (defined in this theme)](#generic_osm_object)
|
||||||
- [address](../Layers/address.md)
|
- [address](../Layers/address.md)
|
||||||
- [crab_address](../Layers/crab_address.md)
|
|
||||||
- [current_view](../Layers/current_view.md)
|
- [current_view](../Layers/current_view.md)
|
||||||
|
|
||||||
Available languages:
|
Available languages:
|
||||||
|
|
|
@ -419,7 +419,7 @@ The default value is _false_
|
||||||
|
|
||||||
The mode the application starts in, e.g. 'map', 'dashboard' or 'statistics'
|
The mode the application starts in, e.g. 'map', 'dashboard' or 'statistics'
|
||||||
|
|
||||||
This documentation is defined in the source code at [generateDocs.ts](ervdvn/git2/MapComplete/scripts/generateDocs.ts#L452)
|
This documentation is defined in the source code at [generateDocs.ts](ervdvn/git2/MapComplete/scripts/generateDocs.ts#L455)
|
||||||
|
|
||||||
The default value is _map_
|
The default value is _map_
|
||||||
|
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -12112,9 +12112,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001716",
|
"version": "1.0.30001717",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001716.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001717.tgz",
|
||||||
"integrity": "sha512-49/c1+x3Kwz7ZIWt+4DvK3aMJy9oYXXG6/97JKsnjdCk/6n9vVyWL8NAwVt95Lwt9eigI10Hl782kDfZUUlRXw==",
|
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -186,7 +186,13 @@ class VeloParkToGeojson extends Script {
|
||||||
[6.15665815596, 51.4750237087],
|
[6.15665815596, 51.4750237087],
|
||||||
])
|
])
|
||||||
|
|
||||||
const alreadyLinkedQuery = new Overpass(Constants.defaultOverpassUrls[0], new RegexTag("ref:velopark", /.+/), [], new ImmutableStore(60 * 5), false)
|
const alreadyLinkedQuery = new Overpass(
|
||||||
|
Constants.defaultOverpassUrls[0],
|
||||||
|
new RegexTag("ref:velopark", /.+/),
|
||||||
|
[],
|
||||||
|
new ImmutableStore(60 * 5),
|
||||||
|
false
|
||||||
|
)
|
||||||
const alreadyLinkedFeatures = (await alreadyLinkedQuery.queryGeoJson(bboxBelgium))[0]
|
const alreadyLinkedFeatures = (await alreadyLinkedQuery.queryGeoJson(bboxBelgium))[0]
|
||||||
const seenIds = new Set<string>(
|
const seenIds = new Set<string>(
|
||||||
alreadyLinkedFeatures.features.map((f) => f.properties?.["ref:velopark"])
|
alreadyLinkedFeatures.features.map((f) => f.properties?.["ref:velopark"])
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { TagsFilter } from "../../Tags/TagsFilter"
|
||||||
import { BBox } from "../../BBox"
|
import { BBox } from "../../BBox"
|
||||||
import { OsmTags } from "../../../Models/OsmFeature"
|
import { OsmTags } from "../../../Models/OsmFeature"
|
||||||
|
|
||||||
("use strict")
|
;("use strict")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper around the 'Overpass'-object.
|
* A wrapper around the 'Overpass'-object.
|
||||||
|
|
|
@ -286,7 +286,7 @@ export class ImageUploadManager {
|
||||||
let absoluteUrl: string
|
let absoluteUrl: string
|
||||||
|
|
||||||
try {
|
try {
|
||||||
({ key, value, absoluteUrl } = await this._uploader.uploadImage(
|
;({ key, value, absoluteUrl } = await this._uploader.uploadImage(
|
||||||
blob,
|
blob,
|
||||||
location,
|
location,
|
||||||
author,
|
author,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import osmtogeojson from "osmtogeojson"
|
||||||
import { FeatureCollection, Geometry } from "geojson"
|
import { FeatureCollection, Geometry } from "geojson"
|
||||||
import { OsmTags } from "../../Models/OsmFeature"
|
import { OsmTags } from "../../Models/OsmFeature"
|
||||||
|
|
||||||
("use strict")
|
;("use strict")
|
||||||
/**
|
/**
|
||||||
* Interfaces overpass to get all the latest data
|
* Interfaces overpass to get all the latest data
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -190,7 +190,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
||||||
provider: "panoramax",
|
provider: "panoramax",
|
||||||
direction: imageData.properties["view:azimuth"],
|
direction: imageData.properties["view:azimuth"],
|
||||||
osmTags: {
|
osmTags: {
|
||||||
panoramax: imageData.id
|
panoramax: imageData.id,
|
||||||
},
|
},
|
||||||
thumbUrl: imageData.assets.thumb.href,
|
thumbUrl: imageData.assets.thumb.href,
|
||||||
date: new Date(imageData.properties.datetime).getTime(),
|
date: new Date(imageData.properties.datetime).getTime(),
|
||||||
|
@ -199,22 +199,26 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
||||||
detailsUrl: imageData.id,
|
detailsUrl: imageData.id,
|
||||||
details: {
|
details: {
|
||||||
isSpherical:
|
isSpherical:
|
||||||
imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular"
|
imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async fetchImages(lat: number, lon: number): Promise<P4CPicture[]> {
|
public async fetchImages(lat: number, lon: number): Promise<P4CPicture[]> {
|
||||||
const radiusSettings = [{
|
const radiusSettings = [
|
||||||
place_fov_tolerance: 180,
|
{
|
||||||
radius: 15
|
place_fov_tolerance: 180,
|
||||||
}, {
|
radius: 15,
|
||||||
place_fov_tolerance: 180,
|
},
|
||||||
radius: 25
|
{
|
||||||
}, {
|
place_fov_tolerance: 180,
|
||||||
place_fov_tolerance: 90,
|
radius: 25,
|
||||||
radius: 50
|
},
|
||||||
}]
|
{
|
||||||
|
place_fov_tolerance: 90,
|
||||||
|
radius: 50,
|
||||||
|
},
|
||||||
|
]
|
||||||
const promises: Promise<ImageData[]>[] = []
|
const promises: Promise<ImageData[]>[] = []
|
||||||
const maxRadius = this._radius
|
const maxRadius = this._radius
|
||||||
let prevRadius = 0
|
let prevRadius = 0
|
||||||
|
@ -223,7 +227,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher {
|
||||||
place: [lon, lat],
|
place: [lon, lat],
|
||||||
place_distance: [prevRadius, Math.min(maxRadius, radiusSetting.radius)],
|
place_distance: [prevRadius, Math.min(maxRadius, radiusSetting.radius)],
|
||||||
place_fov_tolerance: radiusSetting.place_fov_tolerance,
|
place_fov_tolerance: radiusSetting.place_fov_tolerance,
|
||||||
limit: 50
|
limit: 50,
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
prevRadius = radiusSetting.radius
|
prevRadius = radiusSetting.radius
|
||||||
|
|
|
@ -16,15 +16,23 @@ export default class PlantNet {
|
||||||
url += "&images=" + encodeURIComponent(image)
|
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"]) {
|
if (result["content"]) {
|
||||||
return result["content"]
|
return result["content"]
|
||||||
}
|
}
|
||||||
const errResult = <{
|
const errResult = <
|
||||||
"statusCode": 404,
|
{
|
||||||
"error": "Not Found",
|
statusCode: 404
|
||||||
"message": "Species not found" | string
|
error: "Not Found"
|
||||||
}>JSON.parse(result["errContent"])
|
message: "Species not found" | string
|
||||||
|
}
|
||||||
|
>JSON.parse(result["errContent"])
|
||||||
if (errResult.message === "Species not found") {
|
if (errResult.message === "Species not found") {
|
||||||
return "no_plant_detected"
|
return "no_plant_detected"
|
||||||
}
|
}
|
||||||
|
@ -32,7 +40,6 @@ export default class PlantNet {
|
||||||
console.log("Get error result:", err, ">>>>", result["errContent"])
|
console.log("Get error result:", err, ">>>>", result["errContent"])
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlantNetSpeciesMatch {
|
export interface PlantNetSpeciesMatch {
|
||||||
|
|
|
@ -105,7 +105,14 @@ export default class ThemeViewStateHashActor {
|
||||||
if (found.properties.id.startsWith("last_click")) {
|
if (found.properties.id.startsWith("last_click")) {
|
||||||
return true
|
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)
|
selectedElement.setData(found)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ export default class DependencyCalculator {
|
||||||
"] which calculates the value for " +
|
"] which calculates the value for " +
|
||||||
currentKey,
|
currentKey,
|
||||||
neededBy: layer.id,
|
neededBy: layer.id,
|
||||||
checkHasSnapName: false
|
checkHasSnapName: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
@ -132,7 +132,7 @@ export default class DependencyCalculator {
|
||||||
const params: ExtraFuncParams = {
|
const params: ExtraFuncParams = {
|
||||||
getFeatureById: () => undefined,
|
getFeatureById: () => undefined,
|
||||||
getFeaturesWithin: detectNearyFeatures,
|
getFeaturesWithin: detectNearyFeatures,
|
||||||
getProbablyOverlapsWith: detectNearyFeatures
|
getProbablyOverlapsWith: detectNearyFeatures,
|
||||||
}
|
}
|
||||||
const helpers = ExtraFunctions.constructHelpers(params)
|
const helpers = ExtraFunctions.constructHelpers(params)
|
||||||
// ... Run the calculated tag code, which will trigger the getFeaturesWithin above...
|
// ... Run the calculated tag code, which will trigger the getFeaturesWithin above...
|
||||||
|
|
|
@ -105,9 +105,9 @@
|
||||||
<Tr t={t.addPicture} />
|
<Tr t={t.addPicture} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if noBlur}
|
{#if noBlur}
|
||||||
<span class="subtle text-sm">
|
<span class="subtle text-sm">
|
||||||
<Tr t={t.upload.noBlur} />
|
<Tr t={t.upload.noBlur} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -124,20 +124,21 @@
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
|
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
{#if image !== undefined}
|
{#if image !== undefined}
|
||||||
<img alt="" src={image} aria-hidden="true" />
|
<img alt="" src={image} aria-hidden="true" />
|
||||||
{:else}
|
{:else}
|
||||||
<Camera class="h-12 w-12 p-1" aria-hidden="true" />
|
<Camera class="h-12 w-12 p-1" aria-hidden="true" />
|
||||||
{/if}
|
{/if}
|
||||||
<ArrowUpTray class="w-6 h-6 p-0.5 bg-white rounded-full self-end" style="margin-left: -1rem" />
|
<ArrowUpTray
|
||||||
|
class="h-6 w-6 self-end rounded-full bg-white p-0.5"
|
||||||
|
style="margin-left: -1rem"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col ">
|
<div class="flex flex-col">
|
||||||
|
|
||||||
{#if labelText}
|
{#if labelText}
|
||||||
<div class="md:text-2xl text-center ">
|
<div class="text-center md:text-2xl">
|
||||||
{labelText}
|
{labelText}
|
||||||
</div>
|
</div>
|
||||||
<Tr t={t.selectFile} />
|
<Tr t={t.selectFile} />
|
||||||
|
@ -145,12 +146,11 @@
|
||||||
<Tr cls="md:text-2xl text-center" t={t.selectFile} />
|
<Tr cls="md:text-2xl text-center" t={t.selectFile} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if noBlur}
|
{#if noBlur}
|
||||||
<span class="subtle text-sm">
|
<span class="subtle text-sm">
|
||||||
<Tr t={t.upload.noBlur} />
|
<Tr t={t.upload.noBlur} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</FileSelector>
|
</FileSelector>
|
||||||
|
|
||||||
<div class="subtle text-xs italic">
|
<div class="subtle text-xs italic">
|
||||||
|
|
|
@ -54,9 +54,8 @@
|
||||||
{#if $pending - $failed > 0}
|
{#if $pending - $failed > 0}
|
||||||
<div class="alert">
|
<div class="alert">
|
||||||
<Loading>
|
<Loading>
|
||||||
<div class="w-full flex flex-col">
|
<div class="flex w-full flex-col">
|
||||||
|
<div class="flex w-full justify-between gap-x-8">
|
||||||
<div class="w-full flex justify-between gap-x-8">
|
|
||||||
{#if $pending - $failed === 1}
|
{#if $pending - $failed === 1}
|
||||||
<Tr t={t.upload.one.uploading} />
|
<Tr t={t.upload.one.uploading} />
|
||||||
{:else if $pending - $failed > 1}
|
{:else if $pending - $failed > 1}
|
||||||
|
@ -67,8 +66,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if $progress !== undefined}
|
{#if $progress !== undefined}
|
||||||
<div class="w-full low-interaction h-1 rounded-full overflow-hidden">
|
<div class="low-interaction h-1 w-full overflow-hidden rounded-full">
|
||||||
<div class="bg-black h-1" style={`width: calc(${$progress}%)`}></div>
|
<div class="h-1 bg-black" style={`width: calc(${$progress}%)`} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -135,8 +135,11 @@
|
||||||
|
|
||||||
step.setData("loading")
|
step.setData("loading")
|
||||||
featuresStore.set([])
|
featuresStore.set([])
|
||||||
const overpass = new Overpass(Constants.defaultOverpassUrls[0], undefined,
|
const overpass = new Overpass(
|
||||||
user.split(";").map((user) => "nw(user_touched:\"" + user + "\");"))
|
Constants.defaultOverpassUrls[0],
|
||||||
|
undefined,
|
||||||
|
user.split(";").map((user) => 'nw(user_touched:"' + user + '");')
|
||||||
|
)
|
||||||
if (!maplibremap.bounds.data) {
|
if (!maplibremap.bounds.data) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,9 @@
|
||||||
error = undefined
|
error = undefined
|
||||||
running = true
|
running = true
|
||||||
try {
|
try {
|
||||||
const result: PlantNetResult | "no_plant_detected" = await PlantNet.query(imageUrls.data.slice(0, 5))
|
const result: PlantNetResult | "no_plant_detected" = await PlantNet.query(
|
||||||
|
imageUrls.data.slice(0, 5)
|
||||||
|
)
|
||||||
if (result === "no_plant_detected") {
|
if (result === "no_plant_detected") {
|
||||||
error = "no_plant_detected"
|
error = "no_plant_detected"
|
||||||
expandExplanation = true
|
expandExplanation = true
|
||||||
|
@ -65,26 +67,22 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col mb-4">
|
<div class="mb-4 flex flex-col">
|
||||||
|
|
||||||
<!-- Error message -->
|
<!-- Error message -->
|
||||||
{#if error === "no_plant_detected"}
|
{#if error === "no_plant_detected"}
|
||||||
<Tr cls="alert" t={t.noPlantDetected} />
|
<Tr cls="alert" t={t.noPlantDetected} />
|
||||||
|
|
||||||
{:else if error !== undefined}
|
{:else if error !== undefined}
|
||||||
<Tr cls="alert" t={t.error.Subs({ error })} />
|
<Tr cls="alert" t={t.error.Subs({ error })} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
<!-- Button. If 'done==false', the button should be shown, otherwise <PlantnetSpeciesList> will handle the flow -->
|
<!-- Button. If 'done==false', the button should be shown, otherwise <PlantnetSpeciesList> will handle the flow -->
|
||||||
{#if !done && !running && !selectedOption}
|
{#if !done && !running && !selectedOption}
|
||||||
<button class="w-full flex" on:click={detectSpecies}>
|
<button class="flex w-full" on:click={detectSpecies}>
|
||||||
<Plantnet_logo class="mr-2 shrink-0 h-8 w-8 rounded-full bg-white p-1" />
|
<Plantnet_logo class="mr-2 h-8 w-8 shrink-0 rounded-full bg-white p-1" />
|
||||||
<span class="flex flex-col items-center">
|
<span class="flex flex-col items-center">
|
||||||
<Tr t={t.button} />
|
<Tr t={t.button} />
|
||||||
{#if error !== undefined}
|
{#if error !== undefined}
|
||||||
<div class="flex subtle mt-2">
|
<div class="subtle mt-2 flex">
|
||||||
|
|
||||||
<ArrowPath class="h-6 w-6" />
|
<ArrowPath class="h-6 w-6" />
|
||||||
<Tr t={Translations.t.general.retry} />
|
<Tr t={Translations.t.general.retry} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +98,9 @@
|
||||||
<XCircleIcon
|
<XCircleIcon
|
||||||
slot="upper-right"
|
slot="upper-right"
|
||||||
class="m-4 h-8 w-8 cursor-pointer"
|
class="m-4 h-8 w-8 cursor-pointer"
|
||||||
on:click={() => {running = false}}
|
on:click={() => {
|
||||||
|
running = false
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</PlantNetSpeciesList>
|
</PlantNetSpeciesList>
|
||||||
{:else if !done}
|
{:else if !done}
|
||||||
|
@ -143,13 +143,12 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- Explanation -->
|
<!-- Explanation -->
|
||||||
<div class="my-1 low-interaction">
|
<div class="low-interaction my-1">
|
||||||
|
|
||||||
<AccordionSingle noBorder expanded={expandExplanation}>
|
<AccordionSingle noBorder expanded={expandExplanation}>
|
||||||
<div class="subtle flex justify-start text-sm p-1" slot="header">
|
<div class="subtle flex justify-start p-1 text-sm" slot="header">
|
||||||
<Tr t={t.howTo.title} />
|
<Tr t={t.howTo.title} />
|
||||||
</div>
|
</div>
|
||||||
<div class="p-4 border-low-interaction border-l border-r border-b flex flex-col">
|
<div class="border-low-interaction flex flex-col border-b border-l border-r p-4">
|
||||||
<Tr t={t.takeImages} />
|
<Tr t={t.takeImages} />
|
||||||
<Tr t={t.howTo.intro} />
|
<Tr t={t.howTo.intro} />
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -170,14 +169,11 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- Attribution -->
|
<!-- Attribution -->
|
||||||
<div class="low-interaction flex items-center self-end rounded-xl p-2 px-3 mt-4 w-fit">
|
<div class="low-interaction mt-4 flex w-fit items-center self-end rounded-xl p-2 px-3">
|
||||||
<Plantnet_logo class="mr-2 h-8 w-8 rounded-full bg-white p-1" />
|
<Plantnet_logo class="mr-2 h-8 w-8 rounded-full bg-white p-1" />
|
||||||
<Tr t={t.poweredByPlantnet} />
|
<Tr t={t.poweredByPlantnet} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</AccordionSingle>
|
</AccordionSingle>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
25
src/Utils.ts
25
src/Utils.ts
|
@ -879,7 +879,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
): Promise<
|
): Promise<
|
||||||
| { content: string }
|
| { content: string }
|
||||||
| { redirect: string }
|
| { redirect: string }
|
||||||
| { error: string; url: string; statuscode?: number, errContent?: string }
|
| { error: string; url: string; statuscode?: number; errContent?: string }
|
||||||
> {
|
> {
|
||||||
let result = undefined
|
let result = undefined
|
||||||
for (let i = 0; i < maxAttempts; i++) {
|
for (let i = 0; i < maxAttempts; i++) {
|
||||||
|
@ -917,7 +917,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
): Promise<
|
): Promise<
|
||||||
| { content: string }
|
| { content: string }
|
||||||
| { redirect: string }
|
| { redirect: string }
|
||||||
| { error: string; url: string; statuscode?: number, errContent: string }
|
| { error: string; url: string; statuscode?: number; errContent: string }
|
||||||
> {
|
> {
|
||||||
if (this.externalDownloadFunction !== undefined) {
|
if (this.externalDownloadFunction !== undefined) {
|
||||||
return this.externalDownloadFunction(url, headers)
|
return this.externalDownloadFunction(url, headers)
|
||||||
|
@ -931,13 +931,18 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
} else if (xhr.status === 302) {
|
} else if (xhr.status === 302) {
|
||||||
resolve({ redirect: xhr.getResponseHeader("location") })
|
resolve({ redirect: xhr.getResponseHeader("location") })
|
||||||
} else if (xhr.status === 509 || xhr.status === 429) {
|
} else if (xhr.status === 509 || xhr.status === 429) {
|
||||||
resolve({ error: "rate limited", url, statuscode: xhr.status, errContent: xhr.responseText })
|
resolve({
|
||||||
|
error: "rate limited",
|
||||||
|
url,
|
||||||
|
statuscode: xhr.status,
|
||||||
|
errContent: xhr.responseText,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
resolve({
|
resolve({
|
||||||
error: "other error: " + xhr.statusText + ", " + xhr.responseText,
|
error: "other error: " + xhr.statusText + ", " + xhr.responseText,
|
||||||
url,
|
url,
|
||||||
statuscode: xhr.status,
|
statuscode: xhr.status,
|
||||||
errContent: xhr.responseText
|
errContent: xhr.responseText,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1018,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
headers?: Record<string, string>,
|
headers?: Record<string, string>,
|
||||||
dontCacheErrors = false,
|
dontCacheErrors = false,
|
||||||
maxAttempts = 3
|
maxAttempts = 3
|
||||||
): Promise<{ content: T } | { error: string; url: string; statuscode?: number, errContent?: object }> {
|
): Promise<
|
||||||
|
{ content: T } | { error: string; url: string; statuscode?: number; errContent?: object }
|
||||||
|
> {
|
||||||
const cached = Utils._download_cache.get(url)
|
const cached = Utils._download_cache.get(url)
|
||||||
if (cached !== undefined) {
|
if (cached !== undefined) {
|
||||||
if (new Date().getTime() - cached.timestamp <= maxCacheTimeMs) {
|
if (new Date().getTime() - cached.timestamp <= maxCacheTimeMs) {
|
||||||
|
@ -1023,8 +1030,8 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
const promise =
|
const promise =
|
||||||
/*NO AWAIT as we work with the promise directly */ Utils.downloadJsonAdvanced<T>(
|
/*NO AWAIT as we work with the promise directly */ Utils.downloadJsonAdvanced<T>(
|
||||||
url,
|
url,
|
||||||
headers,
|
headers,
|
||||||
maxAttempts
|
maxAttempts
|
||||||
)
|
)
|
||||||
Utils._download_cache.set(url, { promise, timestamp: new Date().getTime() })
|
Utils._download_cache.set(url, { promise, timestamp: new Date().getTime() })
|
||||||
try {
|
try {
|
||||||
|
@ -1065,7 +1072,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
url: string,
|
url: string,
|
||||||
headers?: Record<string, string>,
|
headers?: Record<string, string>,
|
||||||
maxAttempts = 3
|
maxAttempts = 3
|
||||||
): Promise<{ content: T } | { error: string; url: string; statuscode?: number, errContent?: object }> {
|
): Promise<
|
||||||
|
{ content: T } | { error: string; url: string; statuscode?: number; errContent?: object }
|
||||||
|
> {
|
||||||
const injected = Utils.injectedDownloads[url]
|
const injected = Utils.injectedDownloads[url]
|
||||||
if (injected !== undefined) {
|
if (injected !== undefined) {
|
||||||
return { content: injected }
|
return { content: injected }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"commits": 9694,
|
"commits": 9721,
|
||||||
"contributor": "Pieter Vander Vennet"
|
"contributor": "Pieter Vander Vennet"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,9 +126,6 @@
|
||||||
"fr",
|
"fr",
|
||||||
"en"
|
"en"
|
||||||
],
|
],
|
||||||
"CN": [
|
|
||||||
"zh"
|
|
||||||
],
|
|
||||||
"CO": [
|
"CO": [
|
||||||
"es"
|
"es"
|
||||||
],
|
],
|
||||||
|
|
|
@ -13894,9 +13894,6 @@
|
||||||
"zh_Hans": "中文",
|
"zh_Hans": "中文",
|
||||||
"zh_Hant": "中文",
|
"zh_Hant": "中文",
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"countries": [
|
|
||||||
"CN"
|
|
||||||
],
|
|
||||||
"dir": [
|
"dir": [
|
||||||
"vertical right-to-left",
|
"vertical right-to-left",
|
||||||
"left-to-right"
|
"left-to-right"
|
||||||
|
|
|
@ -10873,10 +10873,6 @@
|
||||||
"if": "value=conflation",
|
"if": "value=conflation",
|
||||||
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"if": "value=crab_address",
|
|
||||||
"then": "crab_address - Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override. Note that HNRLABEL contains the original value, whereas _HNRLABEL contains a slightly cleaned version"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"if": "value=crossings",
|
"if": "value=crossings",
|
||||||
"then": "crossings - Crossings for pedestrians and cyclists"
|
"then": "crossings - Crossings for pedestrians and cyclists"
|
||||||
|
|
|
@ -752,10 +752,6 @@
|
||||||
"if": "value=conflation",
|
"if": "value=conflation",
|
||||||
"then": "<b>conflation</b> (builtin) - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
"then": "<b>conflation</b> (builtin) - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"if": "value=crab_address",
|
|
||||||
"then": "<b>crab_address</b> (builtin) - Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override. Note that HNRLABEL contains the original value, whereas _HNRLABEL contains a slightly cleaned version"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"if": "value=crossings",
|
"if": "value=crossings",
|
||||||
"then": "<b>crossings</b> (builtin) - Crossings for pedestrians and cyclists"
|
"then": "<b>crossings</b> (builtin) - Crossings for pedestrians and cyclists"
|
||||||
|
@ -13529,10 +13525,6 @@
|
||||||
"if": "value=conflation",
|
"if": "value=conflation",
|
||||||
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"if": "value=crab_address",
|
|
||||||
"then": "crab_address - Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override. Note that HNRLABEL contains the original value, whereas _HNRLABEL contains a slightly cleaned version"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"if": "value=crossings",
|
"if": "value=crossings",
|
||||||
"then": "crossings - Crossings for pedestrians and cyclists"
|
"then": "crossings - Crossings for pedestrians and cyclists"
|
||||||
|
@ -35342,10 +35334,6 @@
|
||||||
"if": "value=conflation",
|
"if": "value=conflation",
|
||||||
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
"then": "conflation - If the import-button moves OSM points, the imported way points or conflates, a preview is shown. This layer defines how this preview is rendered. This layer cannot be included in a theme."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"if": "value=crab_address",
|
|
||||||
"then": "crab_address - Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override. Note that HNRLABEL contains the original value, whereas _HNRLABEL contains a slightly cleaned version"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"if": "value=crossings",
|
"if": "value=crossings",
|
||||||
"then": "crossings - Crossings for pedestrians and cyclists"
|
"then": "crossings - Crossings for pedestrians and cyclists"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue