Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit to store list length #12

Open
youdar opened this issue Jan 26, 2020 · 7 comments
Open

Limit to store list length #12

youdar opened this issue Jan 26, 2020 · 7 comments
Assignees

Comments

@youdar
Copy link

youdar commented Jan 26, 2020

It appears that there is some limit to the number of stores in the side list of stores that this method will allow.
adding few stores to the JSON file, so that there are more than 25 stores, cause the Store list to stop from showing up.

How to adjust this limit?

@youdar
Copy link
Author

youdar commented Jan 26, 2020

I tried to limit the number of stores on the list using

for (let i = 0; i < 10; i++) {        
    store = stores[i]      
    const name = document.createElement('p');    
    name.classList.add('place');   
    const currentStore = data.getFeatureById(store.storeid);    
    name.textContent = currentStore.getProperty('name');    
    panel.appendChild(name);    
    const distanceText = document.createElement('p');    
    distanceText.classList.add('distanceText');     
    distanceText.textContent = store.distanceText;    
    panel.appendChild(distanceText);

instead of

stores.forEach((store) => {        
    const name = document.createElement('p');    
    name.classList.add('place');    
    const currentStore = data.getFeatureById(store.storeid);    
    name.textContent = currentStore.getProperty('name');    
    panel.appendChild(name);    
    const distanceText = document.createElement('p');    
    distanceText.classList.add('distanceText');    
    distanceText.textContent = store.distanceText;    
    panel.appendChild(distanceText);    
  });

but is did not work.
if I have less than 25 stores in the JSON file it does work, and shows only the first 10, but if the JSON contains more that 25 stores, the store list does not come on the website at all.

If I just reduce the number of the stores in the JSON, it works, but I would like to be able to show on the list only the 10 closest stores

Also tried to change
showStoresList(map.data, rankedStores);
to .
showStoresList(map.data, rankedStores.slice(0,10));
but this did not help as well

@youdar
Copy link
Author

youdar commented Jan 26, 2020

Also wonder how to make it look nice on a mobile device

@krjo
Copy link

krjo commented Apr 11, 2020

Also ran into this issue. We have hundreds of stores across the US. This tutorial is basically useless if it can only measure distance for 25 stores. Is there a way to get the list of destinations from the current zoom view? For example, after selection a location from autocomplete, the map zooms in and there are only a handful of destinations in view. How to use only those destinations in the distance matrix service? Or is there another work around? I've definitely used store locators that have more than 25 locations...

@paxitus
Copy link

paxitus commented Apr 15, 2020

Just hit the same issue. We have 115 stores. I have really enjoyed setting this up, but couldn't get store list to show until I removed all but 24 of the stores and now it works. If anyone can find a solution I would love to use this project on a couple of sites. Thanks.

@wangela
Copy link
Collaborator

wangela commented Apr 28, 2020

For more complex store locators, you might consider the tutorial/codelab for the NYC Subway Station Locator or the Clothing Store Locator. Both of these are designed to handle larger sets of locations. I'll make a note to add mention of these to the Simple Store Locator codelab!

@wangela
Copy link
Collaborator

wangela commented Nov 25, 2020

Update: See the Full Stack Store Locator codelab to support more than 25 locations.

@wangela wangela self-assigned this Nov 25, 2020
@efrazier
Copy link

efrazier commented Oct 3, 2022

This is some seriously annoying fine print that you only start to guess at the end and then only after you see errors. Why not very clearly state the 25 limit at the very start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants