forked from MapComplete/MapComplete
Merge master
This commit is contained in:
commit
51fa48a01f
151 changed files with 16260 additions and 1872 deletions
|
|
@ -576,7 +576,7 @@ export class Changes {
|
|||
if (createdIds.has(c.id)) {
|
||||
toUpload.push(c)
|
||||
} else {
|
||||
(this._reportError)(
|
||||
this._reportError(
|
||||
`Got an orphaned change. The 'creation'-change description for ${c.type}/${c.id} got lost. Permanently dropping this change:` +
|
||||
JSON.stringify(c)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ export class Geocoding {
|
|||
const b = bbox ?? BBox.global
|
||||
const url = `${
|
||||
Geocoding.host
|
||||
}search?format=json&limit=1&viewbox=${b.getEast()},${b.getNorth()},${b.getWest()},${b.getSouth()}&accept-language=${Locale.language.data}&q=${query}`
|
||||
}search?format=json&limit=1&viewbox=${b.getEast()},${b.getNorth()},${b.getWest()},${b.getSouth()}&accept-language=${
|
||||
Locale.language.data
|
||||
}&q=${query}`
|
||||
return Utils.downloadJson(url)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export abstract class OsmObject {
|
|||
// @ts-ignore
|
||||
this.type = type
|
||||
this.tags = {
|
||||
id: `${this.type}/${id}`
|
||||
id: `${this.type}/${id}`,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ export abstract class OsmObject {
|
|||
const allGeojsons = OsmToGeoJson(
|
||||
{ elements },
|
||||
{
|
||||
flatProperties: true
|
||||
flatProperties: true,
|
||||
}
|
||||
)
|
||||
const feature = allGeojsons.features.find(
|
||||
|
|
@ -120,7 +120,7 @@ export abstract class OsmObject {
|
|||
const blacklist = polygonFeature.polygon === "blacklist"
|
||||
result.set(key, {
|
||||
values: new Set<string>(polygonFeature.values),
|
||||
blacklist: blacklist
|
||||
blacklist: blacklist,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,9 @@ export abstract class OsmObject {
|
|||
}
|
||||
const v = this.tags[key]
|
||||
if (v !== "" && v !== undefined) {
|
||||
tags += ` <tag k="${Utils.EncodeXmlValue(key)}" v="${Utils.EncodeXmlValue(this.tags[key])}"/>
|
||||
tags += ` <tag k="${Utils.EncodeXmlValue(key)}" v="${Utils.EncodeXmlValue(
|
||||
this.tags[key]
|
||||
)}"/>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
|
@ -212,7 +214,7 @@ export class OsmNode extends OsmObject {
|
|||
ChangesetXML(changesetId: string, header?: string): string {
|
||||
const tags = this.TagsXML()
|
||||
return ` <node id="${this.id}" ${header ?? ""} ${
|
||||
changesetId ? " changeset=\"" + changesetId + "\" " : ""
|
||||
changesetId ? ' changeset="' + changesetId + '" ' : ""
|
||||
}${this.VersionXML()} lat="${this.lat}" lon="${this.lon}">
|
||||
${tags} </node>
|
||||
`
|
||||
|
|
@ -233,8 +235,8 @@ ${tags} </node>
|
|||
properties: this.tags,
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [this.lon, this.lat]
|
||||
}
|
||||
coordinates: [this.lon, this.lat],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -264,11 +266,11 @@ export class OsmWay extends OsmObject {
|
|||
const tags = this.TagsXML()
|
||||
let nds = ""
|
||||
for (const node in this.nodes) {
|
||||
nds += " <nd ref=\"" + this.nodes[node] + "\"/>\n"
|
||||
nds += ' <nd ref="' + this.nodes[node] + '"/>\n'
|
||||
}
|
||||
|
||||
return ` <way id="${this.id}" ${header ?? ""} ${
|
||||
changesetId ? "changeset=\"" + changesetId + "\" " : ""
|
||||
changesetId ? 'changeset="' + changesetId + '" ' : ""
|
||||
} ${this.VersionXML()}>
|
||||
${nds}${tags} </way>
|
||||
`
|
||||
|
|
@ -313,18 +315,18 @@ ${nds}${tags} </way>
|
|||
if (this.isPolygon()) {
|
||||
geometry = {
|
||||
type: "Polygon",
|
||||
coordinates: [coordinates]
|
||||
coordinates: [coordinates],
|
||||
}
|
||||
} else {
|
||||
geometry = {
|
||||
type: "LineString",
|
||||
coordinates: coordinates
|
||||
coordinates: coordinates,
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: "Feature",
|
||||
properties: <any>this.tags,
|
||||
geometry
|
||||
geometry,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,8 +54,14 @@ export class Overpass {
|
|||
return `${this._interpreterUrl}?data=${encodeURIComponent(query)}`
|
||||
}
|
||||
|
||||
private async ExecuteQuery(query: string): Promise<[FeatureCollection<Geometry, OsmTags>, Date]> {
|
||||
const json = await Utils.downloadJson<{elements: [], remark, osm3s: {timestamp_osm_base: string}}>(this.buildUrl(query))
|
||||
private async ExecuteQuery(
|
||||
query: string
|
||||
): Promise<[FeatureCollection<Geometry, OsmTags>, Date]> {
|
||||
const json = await Utils.downloadJson<{
|
||||
elements: []
|
||||
remark
|
||||
osm3s: { timestamp_osm_base: string }
|
||||
}>(this.buildUrl(query))
|
||||
|
||||
if (json.elements.length === 0 && json.remark !== undefined) {
|
||||
console.warn("Timeout or other runtime error while querying overpass", json.remark)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue