forked from MapComplete/MapComplete
This commit is contained in:
parent
15ff38a098
commit
d894b13023
12 changed files with 271 additions and 191 deletions
|
@ -55,6 +55,19 @@ export abstract class OsmObject {
|
|||
OsmObject.objectCache.set(id, src);
|
||||
return src;
|
||||
}
|
||||
|
||||
static async DownloadPropertiesOf(id: string): Promise<any> {
|
||||
const splitted = id.split("/");
|
||||
const type = splitted[0];
|
||||
const idN = Number(splitted[1]);
|
||||
if (idN < 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const url = `${OsmObject.backendURL}api/0.6/${id}`;
|
||||
const rawData = await Utils.downloadJson(url)
|
||||
return rawData.elements[0].tags
|
||||
}
|
||||
|
||||
static async DownloadObjectAsync(id: string): Promise<OsmObject> {
|
||||
const splitted = id.split("/");
|
||||
|
@ -64,7 +77,7 @@ export abstract class OsmObject {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const full = !id.startsWith("way") ? "" : "/full";
|
||||
const full = (id.startsWith("way")) ? "/full" : "";
|
||||
const url = `${OsmObject.backendURL}api/0.6/${id}${full}`;
|
||||
const rawData = await Utils.downloadJson(url)
|
||||
// A full query might contain more then just the requested object (e.g. nodes that are part of a way, where we only want the way)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue