Display Nearest Stores

Get one store or list all stores around Woosmap estimated user position.
  1. Find the closest point of sale from the user
  2. Implementation

Minimum acceptable accuracy
Stores are retrieved only for an accuracy of 20km or less.

Find the closest point of sale from the user

Someone visiting a foreign city could access your website application that allows users to search where he can find your store. Using the Woosmap Geolocation API, the Web application has access to nearest assets from the user’s approximate position and it is therefore able to rank the returned assets by proximity to the user’s location.

Implementation

The /geolocation/stores/ endpoint returns the stores nearby the user estimated position. Please, check the Geolocation Docs to see how to use this endpoint in more detail.

const woosmapKey = 'woos-XXXXXXX';
$(document).ready(function() {
   $.ajax({
     url: 'https://api.woosmap.com/geolocation/stores/',
     type: 'GET',
     dataType: 'json',
     data: {
       key: woosmapKey,
       radius: 50000
     },
     success: function(data) {
        if (data.stores && data.stores.features && data.stores.features.length > 0){
            displayStores(data.stores)
        }
     }
   });
});

The woosmapKey should be replaced with your Woosmap Project Public Key. The endpoint returns a list of nearby stores we take the first one.

Was this article helpful?
Have more questions? Submit a request