GET /query_locate

Query Locate

Geocode a search query to latitude and longitude coordinates using Google Maps.

Google Maps Scraper API

Geocode a text query into geographic coordinates. This endpoint resolves a location name, address, or place description into precise latitude and longitude values, which can then be used with other endpoints like Search Nearby.

HTTP Request

1
GET /query_locate

Parameters

ParameterTypeRequiredDefaultDescription
querystringYesThe location query to geocode (e.g., “New York City”, “1600 Amphitheatre Parkway”)
languagestringNo"en"Language code for the response
countrystringNo"us"Country code for regional bias
latnumberNoLatitude hint to bias results toward a specific area
lngnumberNoLongitude hint to bias results toward a specific area
zoomintegerNo7Map zoom level (3-21). Higher values give more precise local results

Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "status": true,
  "request_id": "5049d6ac-80c2-3c9e-d475-c271555d",
  "location": {
    "id": null,
    "name": null,
    "altitude": 195601.04002514173,
    "latitude": 40.00249795,
    "longitude": -75.11801455000001,
    "zoom": 7
  },
  "request_params": {
    "query": "Philadelphia, PA"
  }
}

Response Fields

FieldTypeDescription
statusbooleantrue when the request succeeded
request_idstringUnique identifier for this request
locationobjectThe resolved location. There is no data array on this endpoint
location.idstring/nullInternal location identifier, often null
location.namestring/nullResolved location name, often null
location.altitudenumberViewport altitude in metres, derived from zoom
location.latitudenumberLatitude of the resolved location
location.longitudenumberLongitude of the resolved location
location.zoomintegerZoom level the coordinates correspond to

Notes

  • This endpoint only geocodes. It returns no businesses. To geocode and search in one call, use Locate and Search .
  • A query that resolves to nothing still returns status: true, with the location fields set to null. Check location.latitude before using the result.

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import requests

url = "https://google-maps-extractor2.p.rapidapi.com/query_locate"

querystring = {
    "query": "New York City",
    "language": "en",
    "country": "us",
    "zoom": "7"
}

headers = {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "google-maps-extractor2.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)
data = response.json()

print(f"Latitude: {data['location']['latitude']}")
print(f"Longitude: {data['location']['longitude']}")
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
const url = "https://google-maps-extractor2.p.rapidapi.com/query_locate";

const params = new URLSearchParams({
  query: "New York City",
  language: "en",
  country: "us",
  zoom: "7",
});

const response = await fetch(`${url}?${params}`, {
  method: "GET",
  headers: {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "google-maps-extractor2.p.rapidapi.com",
  },
});

const data = await response.json();
console.log(`Latitude: ${data.location.latitude}`);
console.log(`Longitude: ${data.location.longitude}`);
1
2
3
4
5
6
7
curl -G "https://google-maps-extractor2.p.rapidapi.com/query_locate" \
  --data-urlencode "query=New York City" \
  --data-urlencode "language=en" \
  --data-urlencode "country=us" \
  --data-urlencode "zoom=7" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: google-maps-extractor2.p.rapidapi.com"
  • Search Nearby — Search for businesses using the coordinates returned by this endpoint
  • Locate and Search — Combine geocoding and business search in a single call
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI