forked from MapComplete/MapComplete
Velopark: load some more data fields
This commit is contained in:
parent
5130a2b73a
commit
c46e9da511
1 changed files with 13 additions and 8 deletions
|
@ -643,9 +643,7 @@ export default class LinkedDataLoader {
|
|||
allPartialResults.push(r)
|
||||
}
|
||||
|
||||
const results = this.mergeResults(...allPartialResults)
|
||||
|
||||
return results
|
||||
return this.mergeResults(...allPartialResults)
|
||||
}
|
||||
|
||||
private static veloparkCache : Record<string, Feature[]> = {}
|
||||
|
@ -655,9 +653,10 @@ export default class LinkedDataLoader {
|
|||
* The id will be saved as `ref:velopark`
|
||||
* @param url
|
||||
*/
|
||||
public static async fetchVeloparkEntry(url: string): Promise<Feature[]> {
|
||||
if(this.veloparkCache[url]){
|
||||
return this.veloparkCache[url]
|
||||
public static async fetchVeloparkEntry(url: string, includeExtras: boolean = false): Promise<Feature[]> {
|
||||
const cacheKey = includeExtras+url
|
||||
if(this.veloparkCache[cacheKey]){
|
||||
return this.veloparkCache[cacheKey]
|
||||
}
|
||||
const withProxyUrl = Constants.linkedDataProxy.replace("{url}", encodeURIComponent(url))
|
||||
const optionalPaths: Record<string, string | Record<string, string>> = {
|
||||
|
@ -674,6 +673,12 @@ export default class LinkedDataLoader {
|
|||
},
|
||||
"schema:dateModified": "_last_edit_timestamp",
|
||||
}
|
||||
if(includeExtras){
|
||||
optionalPaths["schema:address"] = {
|
||||
"schema:streetAddress":"addr"
|
||||
}
|
||||
optionalPaths["schema:description"] = "description"
|
||||
}
|
||||
|
||||
const graphOptionalPaths = {
|
||||
a: "type",
|
||||
|
@ -692,7 +697,7 @@ export default class LinkedDataLoader {
|
|||
"schema:priceSpecification": {
|
||||
"mv:freeOfCharge": "fee",
|
||||
"schema:price": "charge",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const extra = [
|
||||
|
@ -714,7 +719,7 @@ export default class LinkedDataLoader {
|
|||
p["ref:velopark"] = [section]
|
||||
patched.push(LinkedDataLoader.asGeojson(p))
|
||||
}
|
||||
this.veloparkCache[url] = patched
|
||||
this.veloparkCache[cacheKey] = patched
|
||||
return patched
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue