# Clear the map from stores when there is no results

**URL:** <https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118>\
**Category:** Ask the community\
**Tags:** store-locator\
**Created:** [February 25, 2022, 10:47am UTC](https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118 "2022-02-25T10:47:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tucsky](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tucsky](https://forum.woosmap.com/u/Tucsky)\
**Post date:** [February 25, 2022, 10:47am UTC](https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118/1 "2022-02-25T10:47:22Z")

</div>

Hello,

We are using the searchStoresByParameters method to query our stores by location or tags then use mapView.set(‘stores’, stores) with the results.

So when no stores are returned by the dataSource api we are doing mapView.set(‘stores’,) and surprisingly the map will show all the stores regardless of the current filters ! It might be a feature but in our case we don’t think it makes much sense to have all stores displayed if the user search for specific stores. Is it possible to clear the map of the default stores when filters are set and there is no results for them ?

We tried  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/woosmap/original/1X/fc0b1e66030ac0bb9f0e3c6d6249895d1d15f20c.png)  
and  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/woosmap/original/1X/b2e9301831ea4ca6a46146f4c19a55f9ebc24114.png)  
same behavior

Thank you in advance 🙂

---

<div class="post-metadata">

**Author:** ![gael](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.woosmap.com/gael/32/3_2.png) [@gael](https://forum.woosmap.com/u/gael)\
**Post date:** [March 1, 2022, 12:09pm UTC](https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118/2 "2022-03-01T12:09:31Z")

</div>

> **This topic is archived.** `woosmap.TiledView`, `mapView.set('stores')` and `setSearchParameters` belong to the Store Locator JS API, which has been retired. In [Map JS](https://developers.woosmap.com/products/map-api/get-started/) you control what gets drawn yourself, so an empty result set simply means drawing nothing, and the workaround below is no longer needed. See [Display stores overlay](https://developers.woosmap.com/products/map-api/guides/display-stores-overlay/).

Hello @Tucsky,  
Yes, it’s the default behaviour when using `woosmap.TiledView`.  
To return the TiledView to its original display state, without any query or location marker, you should set the properties `'stores'` and `'location'` to null.

```javascript
mapView.set('location', null);
mapView.set('stores', null);

```

This implies to display all the Stores on your Map.

To manage the display of your Stores, you can work with the `mapView.setSearchParameters()` method.

> **[Map Display - Query your Stores](https://developers.woosmap.com/products/js-api/guides/query-stores/#map-display)**
>
> How to search and display stores using query by attributes and location bias.

```javascript
this.mapView.setSearchParameters(new woosmap.search.SearchParameters({query: searchQuery}))

```

**But** , it will properly work only if **you’re not applying a location bias** (lat,lng) to your Search Parameter.

If you’re using a location to search nearby stores, one solution could be to set a query which returns no stores, for example:

```javascript
mapView.setSearchParameters(
  new woosmap.search.SearchParameters({ query: 'tag:"No_Results_Tag"' })
);

```

I know it is not the best we can give you. Preferably, we should support the location bias also in the tiledview setSearchParameters. I will feedback this to our product team.

Please let me know if this can be an acceptable workaround for you.

Thanks.

---

<div class="post-metadata">

**Author:** ![Tucsky](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tucsky](https://forum.woosmap.com/u/Tucsky)\
**Post date:** [March 7, 2022, 1:12pm UTC](https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118/3 "2022-03-07T13:12:46Z")

</div>

We weren’t using mapView.searchParameters at the time and that was the problem. It wasn’t so clear we had to use both set(‘stores’, …) AND setSearchParameters reading the doc 🙂

Thank you

---

<div class="post-metadata">

**Author:** ![gael](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.woosmap.com/gael/32/3_2.png) [@gael](https://forum.woosmap.com/u/gael)\
**Post date:** [September 18, 2026, 4:20pm UTC](https://forum.woosmap.com/t/clear-the-map-from-stores-when-there-is-no-results/118/4 "2026-09-18T16:20:04Z")

</div>


