Recommendation with Geocoding Addresses

How to recommend and post a contribution with a Geocoded search address
  1. Search Stores Nearby an Address
  2. How to Implement the Feature

This API has been deprecated and will be terminated on the 31/03/2021.
Need to automate user geolocation? Check out the Geolocation API instead.

Search Stores Nearby an Address

A classic Workflow to help your visitors find the right store is to offer a Search Address Field. The search result would be the closest point of sale from the geocoded address specifying the estimated distance. The following example demonstrate how to implement such a feature in your web site using Google Geocoding API.

Find a Coffee Shop Near You!



How to Implement the Feature

The Recommend Store usecase already described the steps for recommending, that is load and initialize your project and get the automatic recommendation.

Geocode and Contribute

Below is the process of geocoding the input address (with Google maps in this example) and then contribute to Woosmap by calling woosmapRecommendation.sendUserSearchedPosition().

<input type="text" name="query" id="queryinput" placeholder="Search an Address">
<input type="submit" id="search-geocoding">
function geocodeAddress(geocoder) {
    var address = document.getElementById('queryinput').value;
    geocoder.geocode({'address': address}, function (results, status) {
        if (status === google.maps.GeocoderStatus.OK) {
            var latitude = results[0];
            var longitude = results[0].geometry.location.lng();
            // Search the assets around your location
            searchWoosmapApiAroundLocation(latitude, longitude);
            //Contribute to Woosmap Profile
            woosmapRecommendation.getConsent((consent) => {
                if (consent === true) {
                        lat: latitude,
                        lng: longitude
        } else {
            console.log('Geocode was not successful: ' + status);
function init() {
    var geocoder = new google.maps.Geocoder();
        function () {
<script src="">

Search Around the Geocoded address

We also described this objective in the previous topic. It’s exactly the same code as the search API call takes the Lat/Lng object from geocoded address instead of HTML geolocation.

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