Migrating from Google Places

Migration guide for moving from Google Places to Woosmap Localities APIs.

Google splits Places across three services (AutocompleteService, PlacesService, Geocoder). Woosmap uses a single LocalitiesService with Promises instead of callbacks — so this migration isn’t a pure find-and-replace like the map one.

Watch for these:

  • Replace place_id with public_id everywhere — including in your database if you store identifiers.
  • location.lat is a property, not a function — location.lat() will throw a TypeError.
  • Autocomplete results come back as localities, not predictions.
  • Google Places returns addresses by default. Woosmap Localities doesn’t — add address to the types parameter if you need them.
  • Use key client-side, private_key server-side.

REST Endpoint Paths

Service Google Woosmap
Autocomplete /maps/api/place/autocomplete/ /localities/autocomplete/
Details /maps/api/place/details/ /localities/details/
Geocoding /maps/api/geocode/ /localities/geocode/
Nearby /maps/api/place/nearbysearch/ /localities/nearby/

Autocomplete + Details

Google needs two service instances; Woosmap handles both with one:

Google Places SDK

javascript
        const autocompleteService = new google.maps.places.AutocompleteService();
autocompleteService.getPlacePredictions({ input: "10 downing" }, (predictions, status) => {
  if (status === "OK" && predictions) {
    const firstPlaceId = predictions[0].place_id;
    getDetails(firstPlaceId);
  }
});

function getDetails(placeId) {
  const placesService = new google.maps.places.PlacesService(document.createElement("div"));
  placesService.getDetails({ placeId: placeId }, (place, status) => {
    if (status === "OK" && place) {
      console.log(place.formatted_address);
      console.log(place.geometry.location.lat()); // lat() is a function
    }
  });
}

    

Woosmap Map JS API

javascript
        const localitiesService = new woosmap.map.LocalitiesService();

localitiesService
  .autocomplete({ input: "10 downing" })
  .then((response) => {
    if (response.localities && response.localities.length > 0) {
      const firstPublicId = response.localities[0].public_id; // public_id, not place_id
      getDetails(firstPublicId);
    }
  })
  .catch((err) => console.error(err));

function getDetails(publicId) {
  localitiesService
    .getDetails({ publicId: publicId })
    .then((response) => {
      const result = response.result;
      console.log(result.formatted_address);
      console.log(result.geometry.location.lat); // lat is a property, not a function
    })
    .catch((err) => console.error(err));
}

    

Forward Geocoding

javascript
        // Google Maps
const geocoder = new google.maps.Geocoder();
geocoder.geocode({ address: "10 Downing Street, London" }, (results, status) => {
  if (status === "OK") {
    console.log(results[0].geometry.location.lat()); // function
  }
});

// Woosmap
const localitiesService = new woosmap.map.LocalitiesService();
localitiesService.geocode({ address: "10 Downing Street, London" }).then((response) => {
  console.log(response.results[0].geometry.location.lat); // property
});

    

Reverse Geocoding

⚠️ This one catches people: Google uses the parameter name location, Woosmap uses latlng.

javascript
        // Google Maps
const geocoder = new google.maps.Geocoder();
geocoder.geocode({ location: { lat: 48.879017, lng: 2.331382 } }, (results, status) => {
  if (status === "OK") {
    console.log(results[0].formatted_address);
  }
});

// Woosmap
const localitiesService = new woosmap.map.LocalitiesService();
localitiesService.geocode({ latlng: { lat: 48.879017, lng: 2.331382 } }).then((response) => {
  console.log(response.results[0].formatted_address);
});

    

Parameter Mapping

Feature Google Places Woosmap Localities
Place Identifier place_id public_id
Authentication key key or private_key
Autocomplete Text input input
Country Filtering components=country:XX components=country:XX
Search Center Point location location
Reverse geocode location (JS SDK) latlng (JS SDK)

What Localities Doesn’t Cover

Woosmap Localities focuses on location data — addresses, coordinates, administrative areas, and POIs (though less granular than Google Places). If you use Google Places for business details like photos, reviews, ratings, or opening hours, those aren’t part of the Localities API. For your own business locations, the Store API is designed exactly for that — manage and search your stores with full custom properties.

Was this helpful?