Skip to main content
All CollectionsManaging DataIntegrations
Importing data from Google Places
Importing data from Google Places

The Google Places API can provide rich location content including hours, reviews and photos

Michael Fatica avatar
Written by Michael Fatica
Updated over a week ago

MetaLocator can import data from multiple sources, including Google Places.

Google Places can be used to enrich the data existing your MetaLocator. For example, to import location hours, photos or to correct names and so forth.

Important: The Google API is not free. Google charges a variable fee per API call based on the type of data requested. Be sure you fully understand the associated costs before configuring Google Places. Google Places data must also be used in compliance with Google's Terms of Use.

Step 1. Obtain a Google API Key.

To obtain a Google API key, follow their instructions here. The steps are generally to :

  1. Create a key

  2. Authorize the Google Places API for the key

Once you have a Google Places API key, configure it in MetaLocator as follows.

  1. Click the User icon in the upper right of the MetaLocator control panel toolbar

  2. Click My User Profile

  3. Click Toggle Advanced Settings

  4. Scroll down to google_places_api_key and paste the provided API key

  5. Click Save at the bottom of the screen

Step 2. Create a Google Place ID Field in MetaLocator

To enrich your data from the Google Places API, MetaLocator needs to know the Google Place ID for each record in your data and so the first step here is to create a field to store the PlaceID.

  1. Click Locations, then Fields

  2. Click New, then choose Google Place ID from the Field Type list.

  3. Provide a name for the field, we recommend Google Place ID

Step 3. Populate the Google Place ID for your locations

Google Place IDs can be populated manually or in bulk.

Populating Google Place ID data manually

  1. Click Locations, then All Records

  2. Find the location for which the Google Place needs updating

  3. Click the name of the location and then the Custom Fields tab.

  4. Enter the name of the location as shown below. Google's Places API will suggest results accordingly.

  5. Choose the suggestion that best matches your result.

  6. Click Save to associate the Google Place ID with the location record.

Populating Google Place ID data in bulk

A background job can be created to regularly attempt to populate the Google Place ID for any records that have no Google Place ID.

Important: Be sure your data is properly geocoded before populating the Google Place ID in bulk. Additionally, any major geocoding issues in the Data Quality Dashboard should be addressed prior.

To create the job, follow these steps:

  1. Click Background processes in the MetaLocator tool bar

  2. Click New and choose PopulateGooglePlaces from the Job Type drop down.

  3. Provide a recognizable name, such as "My Google Places" job.

Populate the parameters as below:

The following parameter is required:

  • googleplaces_apikey

The following parameters are optional

  • populate_googleplaces_inputtype: One of phone or textquery (default, recommended). When phone is provided, the API will search for locations based on the value found in the phone field. The phone number should be in an international format (E.g. +18002316526). MetaLocator will attempt to format the phone automatically. If no value or textquery is provided for this option, the system will search based on the Name field. It is therefore important that the name field value represent the real location name as found on Google. The API is great at handling differences in spelling but may not find results when the Name field is improperly set.

With data geocoded, and the job properly configured. The system is ready to obtain a Google Place ID for each location. This will call the Google Places API once for each record using the Text Search (ID Only) SKU. As of this writing, that API call is free to run.

To run the job,

  1. Click Save

  2. Click Published

  3. Click Scheduled

  4. Optionally, select the checkbox next to the job and choose Force from the toolbar to run the job immediately.

The job will run and process any Geocoded records without a Google Place ID value set.

For those locations where inconclusive or no matches are found, the Google Place ID field will contain

  • NO_MATCH - The API returned no matches when searching for the location by name, or by phone within 5 miles of the geocoded latitude and longitude. In these cases, the Google Place ID should be populated manually as described above.

Importing Data from Google Places

  1. With a Google Place ID populated for each record as described above, click Locations, Import, and choose Google Places from the list of Data Sources:

  2. Enter your API Key if not already provided

  3. Choose the appropriate Place Details value to populate the desired fields. The lower the tier of place details requested, the lower the cost. MetaLocator currently supports the following fields.

    1. Place ID: Unique identifier for each place.

    2. Name: Name of the place.

    3. Formatted Address: The complete address as returned by Google Places.

    4. Address Components: City state country and postal code fields

    5. Latitude and Longitude: Geographical coordinates of the place.

    6. Phone Number: Internationally formatted phone number.

    7. Website URL: URL of the place’s official website.

    8. Opening Hours: Information on the operating hours of the place. they should be translated into metal locators hours format ready for import

    9. Image: Primary image associated with the place.

    10. Photo Gallery: Array of additional photos available for the place.

    11. Rating: Average user rating for the place.

    12. Reviews: Individual user reviews that represent a summary of user sentiment as determined by Google, including the text of the review, author name, rating, and date. Google Places includes up to 5 reviews.

    13. Types: Array of place types (e.g., restaurant, park, museum). These can be imported into a MetaLocator Category field.

    14. User Ratings Total: The total number of ratings for the place.

  4. Limit photos (optional)

    1. Google requires a separate API call for each photo, and making those API calls can significantly slow down the import operation. Set this to zero to skip importing Photos entirely.

  5. Limit Records (optional)

    1. To limit the number of API calls made during import, this parameter can be set to a lower number here, and then later modified in the job configuration.

  6. Click Next to extract the initial data import from Google Places. This can take a few minutes depending on the number of records.

  7. Make any mapping choices. Many users choose to exclude the Name, Address, City, State and Phone fields to preserve their own information. Map any fields to Ignore that should not overwrite existing data. If included in the import, the AverageRating can be mapped to a custom decimal field of the same name. Additionally userRatingTotal can also be mapped to a custom integer field. PlaceTypes can also be imported as a Category field if required for your application.

  8. Choose Update Existing & Skip New on the options screen.

  9. Choose Finish.

At this point your data will be updated to include the selected information from Google Places.

Leveraging Google Places Review Data

Google Places provides specially limited review data. It includes up to 5 actual reviews which include a star rating and commentary and then an "Average Rating" and a "User Rating Total" which represents the total number of reviews that contribute to the Average Rating.

To display these values in the locator as "star" reviews, the Review Summary field can be customized as shown below. In this example we have created the custom fields AverageRating and userRatingTotal in MetaLocator and populated the data from the Google Places API as described above.

Did this answer your question?