Resolve a free-text Google Maps query such as a city or a trade plus a place into latitude, longitude and zoom.

View all Google Maps Data API: Business Search, Reviews & Photos endpoints →

Given a text query, returns the most relevant GPS coordinates for it as a single location object. Send the required query, either general such as "restaurant in New York City" or specific such as "New York City, NY, USA", and optionally add country, language, lat, lng and zoom (3 zoomed out to 21 zoomed in, per the endpoint documentation). The documentation says a query like "restaurant in New York" resolves to the coordinates of New York, so the result is the point for the place the query names, not a list of businesses. The response is a JSON object with status (true on success), request_id, a location object and the echoed request_params. In a live test call with only query set to "attorney in Philadelphia, PA, USA", location held id and name (both null), altitude (97787.43; the unit is not documented), latitude (39.9525839), longitude (-75.1652215) and zoom (7), and request_params echoed just the query. The documentation says status is false on failure, but no failed call was captured. The response example published with the endpoint is an empty object, so the fields above come from the live test call only.

API Features

Query text to one map point Returns a single location object with latitude and longitude for the query instead of a list of candidate places, so one GET request gives you a point you can store or reuse.
General or precise queries Accepts a loose phrase such as "restaurant in New York City" or a precise one such as "New York City, NY, USA"; per the documentation the loose form resolves to the place named in it.
Zoom and altitude in the result The location object also carries zoom (7 in the test call, with no zoom sent) and an altitude value, which a map client can use to frame an initial view.
Optional locale and center inputs country, language, lat, lng and zoom are all optional. Their effect on ranking is not detailed in the documentation, so test them on your own queries before depending on them.
Echoed inputs in the reply request_params repeats the values the call used (only query in the test call), which makes it easy to match a stored coordinate pair to the text that produced it.
Output that feeds nearby search The test call returned 39.9525839, -75.1652215, the same pair pre-filled in the search nearby form, so latitude and longitude can be passed on as lat and lng.

Live API Demo

GET /api/project/google-maps-extractor/query-locate

Request cost is temporarily unavailable. No price is assumed.

View pricing

API Response (JSON)

{}
curl -X GET 'https://api.opendata-api.com/api/project/google-maps-extractor/query-locate?key=<API_KEY>&query=attorney+in+Philadelphia%2C+PA%2C+USA'
📢
Need Help?
If you encounter API issues or need other API requirements, please contact us.
Contact Us

Use Cases

Frequently asked questions

What does the query locate endpoint return?

A JSON object with status, request_id, a location object and the echoed request_params. In a live test call the location held id and name (both null), altitude, latitude, longitude and zoom. It is one point for the query, not a list of businesses.

Which parameters are required?

Only query is required; the sample form uses "attorney in Philadelphia, PA, USA". country, language, lat, lng and zoom are optional. Zoom is documented as 3 (zoomed out) to 21 (zoomed in); the other optional values are not enumerated in the endpoint documentation.

Does it return businesses?

No. It returns the coordinates related to the query, such as the city named in it. To list businesses, call search nearby with those coordinates, or use locate and search, which does both steps in one request.

Why are id and name null in the location object?

Both were null in the test call, and the documentation does not say when they are filled. Treat latitude, longitude and zoom as the fields to rely on and verify id and name on your own queries.

What do lat, lng and zoom do?

They are documented as the latitude and longitude of the query location and a map zoom level from 3 to 21. How they change the returned point was not covered by the test call. Note that the response still included zoom (7) when no zoom was sent.

How do I use the result with search nearby?

Pass the returned latitude and longitude as lat and lng, together with a query such as "attorney". The two calls were not run as one chain in the test, but the coordinates returned for "attorney in Philadelphia, PA, USA" are the same pair pre-filled in the search nearby form.

How are failures reported?

The documentation says status is false on failure and lists a 422 validation response with a detail array of loc, msg and type entries. The test call succeeded, so neither shape was observed; handle both in your client.

Related operations

Guides

View Subscription Plans →