Use Google Maps Related Place & Competitor Finder with Python
Find the related and 'people also search for' places Google Maps shows on a business, hotel, or landmark page. Get each related place's name, rating, review count, category, coordinates, and image, linked back to the place you searched.
1. Choose the data you need
Review the published README for supported collection modes, examples, and limits. The recipe below uses the current published input definition.
2. Prepare a source-based input
This JSON contains published prefills and required-field defaults. Review every value for your task before running it; it is not a promise of successful collection.
{
"deduplicate": true,
"includeDetails": false,
"includeMedia": true,
"language": "en",
"maxItems": 3,
"minSimilar": 1,
"mode": "byPlace",
"placeUrls": [
"https://www.google.com/maps/place/The+Ritz+London/@51.5070782,-0.1416273,17z/data=!3m1!4b1!4m6!3m5!1s0x48760529d30fc857:0x596135811e044014!8m2!3d51.5070782!4d-0.1416273!16zL20vMDQ3enJ2?hl=en"
],
"similaritySource": "auto",
"sortBy": "recommended"
}
Download input.example.json and save your reviewed copy as input.json.
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | optional | Choose how to enter the source places. |
placeUrls | array | optional | Google Maps place URLs, canonical ChIJ Place IDs, or legacy 0x…:0x… feature IDs. Mixed values are allowed (mode=byPlace). |
searchQueries | array | optional | Business, hotel, or landmark names to resolve and analyze (mode=byQuery). |
location | string | optional | City or area appended to every place name (mode=byQuery). |
maxItems | integer | optional | Maximum number of similar places to return across all sources. |
similaritySource | string | optional | Auto uses Google's related carousel and falls back to same-category nearby places when the carousel has fewer than Min similar. Carousel never uses the fallback. Same category skips the carousel. |
minSimilar | integer | optional | In auto mode, use the same-category fallback when the carousel has fewer usable rows than this number and cannot already fill Max results. |
categoryOverride | string | optional | Use this category for the same-category fallback instead of the source place's own category. |
minRating | number | optional | Drop related places rated below this value. Places without a published rating are dropped when this is above zero. |
minReviews | integer | optional | Drop related places with fewer than this many reviews. |
maxDistanceKm | number | optional | Keep only related places within this straight-line distance from the source. Requires published coordinates. |
categoryFilter | string | optional | Keep only places whose category list contains this text (case-insensitive). |
sortBy | string | optional | Order of the returned rows. Recommended keeps Google's carousel and search order. |
deduplicate | boolean | optional | Keep one row per place, using the canonical Place ID, then the feature ID, then name and coordinates. |
includeDetails | boolean | optional | Look up each returned place's own page for its canonical Place ID, address, website, phone, categories, plus code, photo count, and image. Adds one request per row and slows dense runs. |
includeMedia | boolean | optional | Include the image URL when Google publishes one. |
language | string | optional | Google Maps interface language. Affects names, categories, and the fallback category query. |
3. Start an Actor run
Set APIFY_TOKEN in your environment. Python 3.10 or newer is sufficient; this recipe uses no third-party packages.
Execution may incur charges. Review current pricing on Apify. The request asks for a 120-second timeout and a charge limit; these settings are subject to Apify’s pricing and do not guarantee an all-inclusive spending cap.
import json
import os
import urllib.request
# Save the schema-derived example as input.json; review and edit it first.
with open("input.json", encoding="utf-8") as stream:
actor_input = json.load(stream)
token = os.environ["APIFY_TOKEN"]
request = urllib.request.Request(
"https://api.apify.com/v2/acts/d1d5hOcDg4pByYO0X/runs?timeout=120&maxTotalChargeUsd=0.50",
data=json.dumps(actor_input).encode("utf-8"),
headers={"Authorization": "Bearer " + token, "Content-Type": "application/json"},
method="POST",
)
# This starts a potentially billable run. Do not automatically retry this POST.
with urllib.request.urlopen(request, timeout=40) as response:
run = json.load(response)["data"]
print("Run ID:", run["id"])
print("Status:", run["status"])
# Inspect and download results in Apify Console once the run succeeds.
4. Inspect the actual results
Open the run in Apify Console and wait for a successful completion. Use the published output schema to locate results and the dataset schema to understand declared views. Missing or optional record fields must not be treated as guaranteed values.
One row per related place, with its explicit relation provenance (Google carousel or same-category nearby), canonical and legacy identifiers, category, rating, reviews, contacts, coordinates, image, straight-line distance, and a back-reference to the source place.
Questions before you run
Which inputs are required?
No top-level fields are marked required in the published schema. Conditional requirements can still apply; check the README.
What does this guide verify?
The fields, prefills, and schema links are rendered from the published build. This is a usage recipe, not a paid live extraction test. Source availability and collection results can vary.
What if the run request times out?
Check Apify Console before retrying. The first request may already have created a run. Do not automatically repeat a run-creation POST.
Generated from source build 97AjPnapucPrZpz9l and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.