forked from MapComplete/MapComplete
Refactoring: reorder parameters in overpass, remove old script
This commit is contained in:
parent
1ef82ef6cc
commit
bb33c43950
6 changed files with 13 additions and 122 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Feature, Geometry } from "geojson"
|
||||
import { Feature, FeatureCollection, Geometry } from "geojson"
|
||||
import { UpdatableFeatureSource } from "../FeatureSource"
|
||||
import { ImmutableStore, Store, UIEventSource } from "../../UIEventSource"
|
||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
|
|
@ -7,9 +7,9 @@ import { Overpass } from "../../Osm/Overpass"
|
|||
import { Utils } from "../../../Utils"
|
||||
import { TagsFilter } from "../../Tags/TagsFilter"
|
||||
import { BBox } from "../../BBox"
|
||||
import { FeatureCollection } from "@turf/turf"
|
||||
import { OsmTags } from "../../../Models/OsmFeature"
|
||||
;("use strict")
|
||||
|
||||
("use strict")
|
||||
|
||||
/**
|
||||
* A wrapper around the 'Overpass'-object.
|
||||
|
|
@ -204,7 +204,7 @@ export default class OverpassFeatureSource implements UpdatableFeatureSource {
|
|||
if (filters.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
return new Overpass(new Or(filters), [], interpreterUrl, this.state.overpassTimeout)
|
||||
return new Overpass(interpreterUrl, new Or(filters), [], this.state.overpassTimeout)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import { BBox } from "../BBox"
|
|||
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
|
||||
*/
|
||||
|
|
@ -17,9 +18,9 @@ export class Overpass {
|
|||
private readonly _includeMeta: boolean
|
||||
|
||||
constructor(
|
||||
filter: TagsFilter,
|
||||
extraScripts: string[],
|
||||
interpreterUrl: string,
|
||||
filter: TagsFilter,
|
||||
extraScripts: string[] = [],
|
||||
timeout?: Store<number>,
|
||||
includeMeta = true
|
||||
) {
|
||||
|
|
@ -146,7 +147,7 @@ export class Overpass {
|
|||
* Little helper method to quickly open overpass-turbo in the browser
|
||||
*/
|
||||
public static AsOverpassTurboLink(tags: TagsFilter) {
|
||||
const overpass = new Overpass(tags, [], "", undefined, false)
|
||||
const overpass = new Overpass("", tags, [], undefined, false)
|
||||
const script = overpass.buildScript("", "({{bbox}})", true)
|
||||
const url = "http://overpass-turbo.eu/?Q="
|
||||
return url + encodeURIComponent(script)
|
||||
|
|
|
|||
|
|
@ -135,11 +135,8 @@
|
|||
|
||||
step.setData("loading")
|
||||
featuresStore.set([])
|
||||
const overpass = new Overpass(
|
||||
undefined,
|
||||
user.split(";").map((user) => 'nw(user_touched:"' + user + '");'),
|
||||
Constants.defaultOverpassUrls[0]
|
||||
)
|
||||
const overpass = new Overpass(Constants.defaultOverpassUrls[0], undefined,
|
||||
user.split(";").map((user) => "nw(user_touched:\"" + user + "\");"))
|
||||
if (!maplibremap.bounds.data) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue