Re-enable osm source in all cases, fix #1798
This commit is contained in:
parent
c6a69b35cd
commit
760276922d
3 changed files with 24 additions and 24 deletions
|
@ -57,38 +57,37 @@ export default class LayoutSource extends FeatureSourceMerger {
|
||||||
const nonMvtLayers = osmLayers.filter((l) => !mvtAvailableLayers.has(l.id))
|
const nonMvtLayers = osmLayers.filter((l) => !mvtAvailableLayers.has(l.id))
|
||||||
|
|
||||||
const isLoading = new UIEventSource(false)
|
const isLoading = new UIEventSource(false)
|
||||||
|
|
||||||
|
const osmApiSource = LayoutSource.setupOsmApiSource(
|
||||||
|
osmLayers,
|
||||||
|
bounds,
|
||||||
|
zoom,
|
||||||
|
backend,
|
||||||
|
featureSwitches,
|
||||||
|
fullNodeDatabaseSource
|
||||||
|
)
|
||||||
|
nonMvtSources.push(osmApiSource)
|
||||||
|
|
||||||
|
let overpassSource: OverpassFeatureSource = undefined
|
||||||
if (nonMvtLayers.length > 0) {
|
if (nonMvtLayers.length > 0) {
|
||||||
console.log(
|
console.log(
|
||||||
"Layers ",
|
"Layers ",
|
||||||
nonMvtLayers.map((l) => l.id),
|
nonMvtLayers.map((l) => l.id),
|
||||||
" cannot be fetched from the cache server, defaulting to overpass/OSM-api"
|
" cannot be fetched from the cache server, defaulting to overpass/OSM-api"
|
||||||
)
|
)
|
||||||
const overpassSource = LayoutSource.setupOverpass(
|
overpassSource = LayoutSource.setupOverpass(osmLayers, bounds, zoom, featureSwitches)
|
||||||
osmLayers,
|
nonMvtSources.push(overpassSource)
|
||||||
bounds,
|
|
||||||
zoom,
|
|
||||||
featureSwitches
|
|
||||||
)
|
|
||||||
const osmApiSource = LayoutSource.setupOsmApiSource(
|
|
||||||
osmLayers,
|
|
||||||
bounds,
|
|
||||||
zoom,
|
|
||||||
backend,
|
|
||||||
featureSwitches,
|
|
||||||
fullNodeDatabaseSource
|
|
||||||
)
|
|
||||||
nonMvtSources.push(overpassSource, osmApiSource)
|
|
||||||
|
|
||||||
function setIsLoading() {
|
|
||||||
const loading = overpassSource?.runningQuery?.data || osmApiSource?.isRunning?.data
|
|
||||||
isLoading.setData(loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
overpassSource?.runningQuery?.addCallbackAndRun((_) => setIsLoading())
|
|
||||||
osmApiSource?.isRunning?.addCallbackAndRun((_) => setIsLoading())
|
|
||||||
supportsForceDownload.push(overpassSource)
|
supportsForceDownload.push(overpassSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setIsLoading() {
|
||||||
|
const loading = overpassSource?.runningQuery?.data || osmApiSource?.isRunning?.data
|
||||||
|
isLoading.setData(loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
overpassSource?.runningQuery?.addCallbackAndRun((_) => setIsLoading())
|
||||||
|
osmApiSource?.isRunning?.addCallbackAndRun((_) => setIsLoading())
|
||||||
|
|
||||||
const geojsonSources: UpdatableFeatureSource[] = geojsonlayers.map((l) =>
|
const geojsonSources: UpdatableFeatureSource[] = geojsonlayers.map((l) =>
|
||||||
LayoutSource.setupGeojsonSource(l, mapProperties, isDisplayed(l.id))
|
LayoutSource.setupGeojsonSource(l, mapProperties, isDisplayed(l.id))
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,6 +87,7 @@
|
||||||
if (snapToLayers?.length > 0) {
|
if (snapToLayers?.length > 0) {
|
||||||
const snapSources: FeatureSource[] = []
|
const snapSources: FeatureSource[] = []
|
||||||
for (const layerId of snapToLayers ?? []) {
|
for (const layerId of snapToLayers ?? []) {
|
||||||
|
// We assume that the layer contains the data, as the OSM-API-Feature-source should have loaded them, even though the layer might not be displayed
|
||||||
const layer: FeatureSourceForLayer = state.perLayer.get(layerId)
|
const layer: FeatureSourceForLayer = state.perLayer.get(layerId)
|
||||||
snapSources.push(layer)
|
snapSources.push(layer)
|
||||||
if (layer.features === undefined) {
|
if (layer.features === undefined) {
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
if (!rangeIsShown) {
|
if (!rangeIsShown) {
|
||||||
new ShowDataLayer(map, {
|
new ShowDataLayer(map, {
|
||||||
layer: new LayerConfig(boundsdisplay),
|
layer: new LayerConfig(<any> boundsdisplay),
|
||||||
features: new StaticFeatureSource([
|
features: new StaticFeatureSource([
|
||||||
turf.circle(c, maxDistanceInMeters, {
|
turf.circle(c, maxDistanceInMeters, {
|
||||||
units: "meters",
|
units: "meters",
|
||||||
|
|
Loading…
Reference in a new issue