Places: Limit the number of images displayed on the map to 500,000

This commit is contained in:
Michael Mayer 2022-04-21 22:21:17 +02:00
parent 49b58f30c7
commit 49e9232323

View file

@ -28,6 +28,13 @@ import Thumb from "model/thumb";
export default { export default {
name: 'PPagePlaces', name: 'PPagePlaces',
props: {
staticFilter: {
type: Object,
default: () => {
},
},
},
data() { data() {
return { return {
initialized: false, initialized: false,
@ -37,6 +44,7 @@ export default {
loading: false, loading: false,
url: "", url: "",
attribution: '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>', attribution: '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
maxCount: 500000,
options: {}, options: {},
mapFont: [], mapFont: [],
result: {}, result: {},
@ -245,6 +253,20 @@ export default {
} }
} }
}, },
searchParams() {
const params = {
count: this.maxCount,
offset: 0,
};
Object.assign(params, this.filter);
if (this.staticFilter) {
Object.assign(params, this.staticFilter);
}
return params;
},
search() { search() {
if (this.loading) return; if (this.loading) return;
@ -256,10 +278,12 @@ export default {
this.updateQuery(); this.updateQuery();
// Compose query params.
const options = { const options = {
params: this.filter, params: this.searchParams(),
}; };
// Fetch results from server.
return Api.get("geo", options).then((response) => { return Api.get("geo", options).then((response) => {
if (!response.data.features || response.data.features.length === 0) { if (!response.data.features || response.data.features.length === 0) {
this.loading = false; this.loading = false;