chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-05-08 11:44:03 +02:00
parent e33d448055
commit d2134668b1
25 changed files with 109 additions and 171 deletions

View file

@ -211,7 +211,6 @@ The question is `What is the corresponding Wikidata entity?`
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 tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
This tagrendering has labels
`artwork-question`

View file

@ -214,7 +214,6 @@ The question is `What is the corresponding Wikidata entity?`
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 tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
This tagrendering has labels
`artwork-question`

View file

@ -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)

View file

@ -418,7 +418,6 @@ The question is `What is the corresponding Wikidata entity?`
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 tagrendering is only visible in the popup if the following condition is met: subject:wikidata~.+
This tagrendering has labels
`artwork-question`

View file

@ -13,7 +13,6 @@ This theme contains the following layers:
- [service_ways (defined in this theme)](#service_ways)
- [generic_osm_object (defined in this theme)](#generic_osm_object)
- [address](../Layers/address.md)
- [crab_address](../Layers/crab_address.md)
- [current_view](../Layers/current_view.md)
Available languages:

View file

@ -419,7 +419,7 @@ The default value is _false_
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_

6
package-lock.json generated
View file

@ -12112,9 +12112,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001716",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001716.tgz",
"integrity": "sha512-49/c1+x3Kwz7ZIWt+4DvK3aMJy9oYXXG6/97JKsnjdCk/6n9vVyWL8NAwVt95Lwt9eigI10Hl782kDfZUUlRXw==",
"version": "1.0.30001717",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001717.tgz",
"integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==",
"dev": true,
"funding": [
{

View file

@ -186,7 +186,13 @@ class VeloParkToGeojson extends Script {
[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 seenIds = new Set<string>(
alreadyLinkedFeatures.features.map((f) => f.properties?.["ref:velopark"])

View file

@ -9,7 +9,7 @@ import { TagsFilter } from "../../Tags/TagsFilter"
import { BBox } from "../../BBox"
import { OsmTags } from "../../../Models/OsmFeature"
("use strict")
;("use strict")
/**
* A wrapper around the 'Overpass'-object.

View file

@ -286,7 +286,7 @@ export class ImageUploadManager {
let absoluteUrl: string
try {
({ key, value, absoluteUrl } = await this._uploader.uploadImage(
;({ key, value, absoluteUrl } = await this._uploader.uploadImage(
blob,
location,
author,

View file

@ -6,7 +6,7 @@ import osmtogeojson from "osmtogeojson"
import { FeatureCollection, Geometry } from "geojson"
import { OsmTags } from "../../Models/OsmFeature"
("use strict")
;("use strict")
/**
* Interfaces overpass to get all the latest data
*/

View file

@ -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 = [{
const radiusSettings = [
{
place_fov_tolerance: 180,
radius: 15
}, {
radius: 15,
},
{
place_fov_tolerance: 180,
radius: 25
}, {
radius: 25,
},
{
place_fov_tolerance: 90,
radius: 50
}]
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

View file

@ -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 {

View file

@ -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
}

View file

@ -124,7 +124,7 @@ export default class DependencyCalculator {
"] which calculates the value for " +
currentKey,
neededBy: layer.id,
checkHasSnapName: false
checkHasSnapName: false,
})
return []
@ -132,7 +132,7 @@ export default class DependencyCalculator {
const params: ExtraFuncParams = {
getFeatureById: () => undefined,
getFeaturesWithin: detectNearyFeatures,
getProbablyOverlapsWith: detectNearyFeatures
getProbablyOverlapsWith: detectNearyFeatures,
}
const helpers = ExtraFunctions.constructHelpers(params)
// ... Run the calculated tag code, which will trigger the getFeaturesWithin above...

View file

@ -124,20 +124,21 @@
}}
>
<div class="hidden md:block">
<div class="flex w-full">
{#if image !== undefined}
<img alt="" src={image} aria-hidden="true" />
{:else}
<Camera class="h-12 w-12 p-1" aria-hidden="true" />
{/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 class="flex flex-col ">
<div class="flex flex-col">
{#if labelText}
<div class="md:text-2xl text-center ">
<div class="text-center md:text-2xl">
{labelText}
</div>
<Tr t={t.selectFile} />
@ -150,7 +151,6 @@
</span>
{/if}
</div>
</FileSelector>
<div class="subtle text-xs italic">

View file

@ -54,9 +54,8 @@
{#if $pending - $failed > 0}
<div class="alert">
<Loading>
<div class="w-full flex flex-col">
<div class="w-full flex justify-between gap-x-8">
<div class="flex w-full flex-col">
<div class="flex w-full justify-between gap-x-8">
{#if $pending - $failed === 1}
<Tr t={t.upload.one.uploading} />
{:else if $pending - $failed > 1}
@ -67,8 +66,8 @@
{/if}
</div>
{#if $progress !== undefined}
<div class="w-full low-interaction h-1 rounded-full overflow-hidden">
<div class="bg-black h-1" style={`width: calc(${$progress}%)`}></div>
<div class="low-interaction h-1 w-full overflow-hidden rounded-full">
<div class="h-1 bg-black" style={`width: calc(${$progress}%)`} />
</div>
{/if}
</div>

View file

@ -135,8 +135,11 @@
step.setData("loading")
featuresStore.set([])
const overpass = new Overpass(Constants.defaultOverpassUrls[0], undefined,
user.split(";").map((user) => "nw(user_touched:\"" + user + "\");"))
const overpass = new Overpass(
Constants.defaultOverpassUrls[0],
undefined,
user.split(";").map((user) => 'nw(user_touched:"' + user + '");')
)
if (!maplibremap.bounds.data) {
return
}

View file

@ -48,7 +48,9 @@
error = undefined
running = true
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") {
error = "no_plant_detected"
expandExplanation = true
@ -65,26 +67,22 @@
}
</script>
<div class="flex flex-col mb-4">
<div class="mb-4 flex flex-col">
<!-- Error message -->
{#if error === "no_plant_detected"}
<Tr cls="alert" t={t.noPlantDetected} />
{:else if error !== undefined}
<Tr cls="alert" t={t.error.Subs({ error })} />
{/if}
<!-- Button. If 'done==false', the button should be shown, otherwise <PlantnetSpeciesList> will handle the flow -->
{#if !done && !running && !selectedOption}
<button class="w-full flex" on:click={detectSpecies}>
<Plantnet_logo class="mr-2 shrink-0 h-8 w-8 rounded-full bg-white p-1" />
<button class="flex w-full" on:click={detectSpecies}>
<Plantnet_logo class="mr-2 h-8 w-8 shrink-0 rounded-full bg-white p-1" />
<span class="flex flex-col items-center">
<Tr t={t.button} />
{#if error !== undefined}
<div class="flex subtle mt-2">
<div class="subtle mt-2 flex">
<ArrowPath class="h-6 w-6" />
<Tr t={Translations.t.general.retry} />
</div>
@ -100,7 +98,9 @@
<XCircleIcon
slot="upper-right"
class="m-4 h-8 w-8 cursor-pointer"
on:click={() => {running = false}}
on:click={() => {
running = false
}}
/>
</PlantNetSpeciesList>
{:else if !done}
@ -143,13 +143,12 @@
{/if}
<!-- Explanation -->
<div class="my-1 low-interaction">
<div class="low-interaction my-1">
<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} />
</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.howTo.intro} />
<ul>
@ -170,14 +169,11 @@
</li>
</ul>
<!-- 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" />
<Tr t={t.poweredByPlantnet} />
</div>
</div>
</AccordionSingle>
</div>
</div>

View file

@ -879,7 +879,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
): Promise<
| { content: string }
| { redirect: string }
| { error: string; url: string; statuscode?: number, errContent?: string }
| { error: string; url: string; statuscode?: number; errContent?: string }
> {
let result = undefined
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<
| { content: string }
| { redirect: string }
| { error: string; url: string; statuscode?: number, errContent: string }
| { error: string; url: string; statuscode?: number; errContent: string }
> {
if (this.externalDownloadFunction !== undefined) {
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) {
resolve({ redirect: xhr.getResponseHeader("location") })
} 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 {
resolve({
error: "other error: " + xhr.statusText + ", " + xhr.responseText,
url,
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>,
dontCacheErrors = false,
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)
if (cached !== undefined) {
if (new Date().getTime() - cached.timestamp <= maxCacheTimeMs) {
@ -1065,7 +1072,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
url: string,
headers?: Record<string, string>,
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]
if (injected !== undefined) {
return { content: injected }

View file

@ -1,7 +1,7 @@
{
"contributors": [
{
"commits": 9694,
"commits": 9721,
"contributor": "Pieter Vander Vennet"
},
{

View file

@ -126,9 +126,6 @@
"fr",
"en"
],
"CN": [
"zh"
],
"CO": [
"es"
],

View file

@ -13894,9 +13894,6 @@
"zh_Hans": "中文",
"zh_Hant": "中文",
"_meta": {
"countries": [
"CN"
],
"dir": [
"vertical right-to-left",
"left-to-right"

View file

@ -10873,10 +10873,6 @@
"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."
},
{
"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",
"then": "crossings - Crossings for pedestrians and cyclists"

View file

@ -752,10 +752,6 @@
"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."
},
{
"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",
"then": "<b>crossings</b> (builtin) - Crossings for pedestrians and cyclists"
@ -13529,10 +13525,6 @@
"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."
},
{
"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",
"then": "crossings - Crossings for pedestrians and cyclists"
@ -35342,10 +35334,6 @@
"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."
},
{
"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",
"then": "crossings - Crossings for pedestrians and cyclists"