Hi @annevoelkel,
317 locations is not too much. I have seen pages where they have 3000+ locations on a map without loading issues. The geo-coordinates are stored in the db and everything is loaded into the HTML of the page. Have you tried to provide a page HTML caching with the map page?
Best regards,
Daniel
Hi Daniel,
thanks for your reply. As an alternative solution to the performance problem I tryed to add this recommended java script (https://www.open-user-map.com/knowledge-base/trigger-map-actions-with-javascript/#activate-deactivate-a-marker-category) to the Custom JS:
// Function to get the value of a specific URL parameter
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
// Get the 'oum-category' parameter value from the URL
const categoryNumber = getQueryParam('oum-category');
// Check if the 'oum-category' parameter is present
if (categoryNumber !== null) {
// Click all categories first
document.querySelectorAll('.oum-filter-list label').forEach((category) => {
category.click();
});
// Click specifically on the label based on the 'oum-category' value
// Convert categoryNumber to a 1-based index for :nth-child() selector
const categoryIndex = parseInt(categoryNumber, 10);
if (!isNaN(categoryIndex)) { // Ensure categoryNumber is a valid number
const targetLabel = document.querySelector(.oum-filter-list label:nth-child(${categoryIndex}));
if (targetLabel) {
targetLabel.click();
} else {
console.error('Specified category index is out of range.');
}
} else {
console.error('Invalid category number specified in the URL parameter.');
}
}
The script doesn’t work even when I add ?oum-category=3 to the page load:
https://neu.muenzenwoche.de/institutionen/?oum-category=3
Any idea?
Best regards Anne
Hello Anne,
The script does not work because it is missing the single quotes in line 21. Please copy and paste the script again and it should work.
However – this will not help with a faster loading of the page. If you want to reduce the number of locations on this map by displaying just a specific category, you should use the “type” Shortcode attribute or the corresponding filter setting in the block.
Other than that – have you tried to install a page caching plugin to serve a cached version of the map?
Best regards,
Daniel
Hello Daniel,
thank you very much for your advices. We’ve installed a caching plugin and after the initial load the map loads quick. Perhaps there is a conflict between OUM and our theme Enfold. On another site using theme Total the OUM map loads quickly with more than 1.000 locations and 5 categories without a caching plugin.
Best regards Anne
Okay, good to hear that the caching solved the problem. And thanks for the hint to the Enfold theme.
Best regards,
Daniel