The ‘Nearby places’ functionality has been built into the ‘Search component’ and there’s a quick video below showing hotels plotted around a given radius (1.5km) around a selected place and then plotted onto the map.
Here is the entire documentation for the autocomplete element along with all options, states, events and explanations on how everything works.
Connection and appearance
| Setting |
Description |
| Target map id |
The Map id of the map this search controls. Must match the map’s Map id. |
| Placeholder text |
The grey hint shown in the empty box. |
What the search returns
| Setting |
Description |
| Country restriction |
Limit results to one or more countries, as two-letter codes (for example GB, or GB,FR). Leave blank for no restriction. |
| Language code |
Preferred language for results (for example en). Leave blank to use the device default. |
| Type filter |
Limit results to certain place types (for example locality, or street_address). Leave blank for all types. |
| Region code |
Optional two-letter code (for example GB) that influences address formatting and result ranking. This does not filter results to that country: use Country restriction for that. |
| Query predictions |
When on, plain search-term suggestions (such as “pizza near me”) appear alongside real places. These are not places, so tapping one only fills the box; it does not move the map. Off by default. |
Typing and the predictions list
| Setting |
Description |
| Minimum characters |
How many characters must be typed before predictions are fetched. Default 3. |
| Debounce (ms) |
How long to wait after typing stops before fetching predictions. Default 300. |
| Auto-hide keyboard |
On a phone, the first tap on a result usually just closes the keyboard, so it takes two taps to select. Turn this on to have the keyboard hide itself shortly after results appear, so a single tap then selects. Off by default (the keyboard stays, two taps to select). |
| Auto-hide delay (ms) |
When Auto-hide keyboard is on, how long after the results settle before the keyboard hides. The timer restarts each time the results refresh, so it only hides once the user has stopped typing. Default 800. |
Search area
| Setting |
Description |
| Search area mode |
How to focus the search geographically. Off (the default) biases results towards wherever the map is currently centred. Bias prefers places near the search area but still allows others. Restrict is a hard filter: places outside the area are never shown. Google allows one or the other, never both, which is why this is a single choice. |
| Search area latitude |
The centre of the search area, used when the mode is Bias or Restrict. Ignored when the mode is Off. |
| Search area longitude |
The other half of the search area centre. Set this together with the latitude. |
| Search area radius m |
How far the search area reaches, in metres. A radius is required: Google ignores the centre without one, so 50000 (50km) is used if you leave this blank. |
Distance
| Setting |
Description |
| Distance from lat |
Optional. The latitude to measure distances from. When set with its longitude, the chosen place’s distance appears in the Selected distance m state. |
| Distance from lng |
Optional. The longitude to measure distances from. Set this together with Distance from lat, as distances are only calculated when both are given. |
When a place is chosen
| Setting |
Description |
| Result zoom |
The zoom level the map uses when moving to a chosen place. Leave blank to use the place’s own recommended view. |
| Place marker |
When on, a single marker is dropped on the map at the chosen place. Choosing another place moves that same marker (there is never more than one), and clearing the search box removes it. Off by default. |
Nearby places
| Setting |
Description |
| Nearby places |
When on, choosing a place also looks for places around it (hotels, restaurants, and so on) and publishes them as a list. Off by default. |
| Nearby types |
The kinds of place to look for, such as hotel, or restaurant,cafe for both. Must be Google place types; the full list is at Place Types (New) | Places API | Google for Developers . Capitals, spaces and plurals are tidied up for you (Hotels becomes hotel), but a word Google does not recognise is reported as an error. Only used when Nearby places is on. |
| Nearby exclude types |
Any kinds of place to leave out of the results. Leave blank to exclude nothing. |
| Nearby radius m |
How far around the chosen place to look, in metres. Defaults to 1500 (1.5km). The furthest Google allows is 50000 (50km). |
| Nearby max results |
How many places to return, from 1 to 20. Defaults to 20. Asking for fewer does not cost less, so there is no saving in lowering it. |
| Nearby rank by |
How the results are ordered. Distance puts the nearest first, which suits “what is close to me” lists. Popularity is Google’s own ordering and is the default. |
| Nearby markers |
When on (the default), each place found is plotted on the map. Searching again replaces them, and clearing the search box removes them. |
| Nearby fit bounds |
When on, the map zooms out to frame every place found rather than staying on the searched place. Off by default. |
Styling options
The search element has its own styling section so you can match it to your app:
| Field |
What it does |
| Box background |
The fill of the search box. |
| Box border radius |
How rounded the box corners are. |
| Box border colour |
The box border colour. |
| Box border width |
The box border thickness. |
| Text colour |
The colour of the typed text. |
| Placeholder colour |
The colour of the placeholder hint. |
| Font size |
The size of the typed text. |
| Box vertical padding |
The space above and below the text inside the box. Increase it to make the search box taller, decrease it to make it shorter. |
| List background |
The fill of the predictions dropdown. |
| List border colour |
The border of the predictions dropdown. |
| Prediction primary |
The colour of each prediction’s main line. |
| Prediction secondary |
The colour of each prediction’s smaller second line. |
| Prediction divider |
The colour of the thin line between predictions. |
| Spinner colour |
The colour of the loading spinner shown while searching. |
States
The Google Map Search element publishes the chosen place, so you react to a search on this element (not the map):
The chosen place
| State |
Description |
| Selected latitude |
The latitude of the place the user chose. |
| Selected longitude |
The longitude of the place the user chose. |
| Selected name |
The name of the chosen place (for example “Empire State Building”). |
| Selected address |
The full formatted address of the chosen place. |
| Selected place id |
Google’s unique Place ID for the chosen place. Useful if you want to look the place up again or store a stable reference to it. |
| Selected distance m |
How far the chosen place is, in metres, from the point set in Distance from lat and Distance from lng. Blank unless both of those are set. |
The chosen place’s viewport
| State |
Description |
| Selected viewport NE latitude |
The north-east corner latitude of the place’s recommended viewport (blank if the place has no viewport). |
| Selected viewport NE longitude |
The north-east corner longitude of the place’s recommended viewport. |
| Selected viewport SW latitude |
The south-west corner latitude of the place’s recommended viewport. |
| Selected viewport SW longitude |
The south-west corner longitude of the place’s recommended viewport. |
Nearby places
| State |
Description |
| Nearby places |
The list of places found around the chosen place, when Nearby places is on. Each one carries its name, address, coordinates, types and Google’s suggested icon. Empty when the feature is off or nothing was found. |
Diagnostics
| State |
Description |
| Error |
A message describing the last search problem (for example a missing key or no network). Empty when all is well. |
| Debug logs |
Diagnostic text describing what the search element did (requests, selections, errors). Useful for troubleshooting; you can bind it to a text element while testing. |
Events.
| Event |
When it fires |
| Place selected |
When the user chooses a place from the predictions and the map is moved to it. |
| Nearby places found |
When the nearby results have arrived and any markers have been placed. Use this to show your list. Only fires when Nearby places is on. |
| Error occurred |
When a search fails, for example a missing or invalid API key, or no network. The Error state holds the message. |
If you need to react only once the map has finished moving (rather than the instant a place is chosen), use the map’s own Region changed event.
Notes. The map does not need any special setup beyond its Map id; it watches the channel and moves itself. You can have several maps and several search boxes on one page; just give each map a unique Map id and point each search box at the one it should control.
Focusing the search on an area. By default (Search area mode set to Off) predictions are biased towards the target map’s current centre when it is available, so results near the visible area rank higher. If the map has not reported a centre yet, Google falls back to guessing roughly where the device is. Set the mode to Bias or Restrict when you want to control this yourself:
- Bias means “prefer this area”. Places near the centre you give rank higher, but somewhere further away can still appear if it matches well. Use this when you want helpful local results without ruling anything out.
- Restrict means “only this area”. Anything outside the radius is never returned. Use this when the search genuinely must not offer places elsewhere, such as picking a site within a delivery zone.
Both need a centre (Search area latitude and longitude) and a radius in metres. If you leave the radius blank, 50km is used, because Google ignores the centre entirely when no radius is given.
Showing how far away a place is. Set Distance from lat and Distance from lng to the point you want to measure from, often the user’s location or a fixed depot. The chosen place’s distance in metres then appears in the Selected distance m state. This is measured by Google as part of the search, so it costs nothing extra and needs no calculation on your side. Leave the two fields blank if you do not need distances.
Finding places around the searched place. Turn on Nearby places and the search does a second job: once the user picks a place, it looks for places of the kinds you chose around that spot. Searching “Bournemouth” with Nearby types set to lodging moves the map to Bournemouth and finds the hotels there.
The kinds of place come from the Nearby types setting, not from what the user types. Google’s nearby search takes a type, not a phrase, so the user searches for a location and you decide what to look for around it. A user cannot type “hotels” into the box and have this work: they type where, you configure what.
Choosing the types. These are Google’s own place types, not free wording, so “hotel” works and “places to stay” does not. The full list is here:
https://developers.google.com/maps/documentation/places/web-service/place-types
Use the types from Table A on that page. The plugin tidies up the most common slips for you, so capitals, spaces and plurals are all handled: “Hotels” becomes hotel, “Tourist Attractions” becomes tourist_attraction. It only does this when it is certain, so a real type is never altered. If you use a word Google does not recognise at all, the search reports an error naming it, and the Error state holds the message.
The results arrive in two forms. The Nearby places state holds the full list, each with its name, address, coordinates, types and Google’s suggested icon, ready to show in a repeating group. At the same time, unless you turn Nearby markers off, each one is plotted on the map. Searching again replaces the previous set, and clearing the search box removes them, so they never pile up. Use the Nearby places found event to know when the list is ready.
Two things worth knowing. Each completed search with this feature on makes two calls to Google rather than one, so leave it off unless an app needs it. And the results are Google’s places, not your own records: if you want to show your own listings, use the chosen place’s coordinates from the Selected latitude and Selected longitude states and query your own database with them.
Matching results against your own data. The search element finds places from Google and reports the chosen one’s coordinates. If you want to compare that against addresses held in your own database (for example, “which of my sites are within 5km of the searched address”), that part is done in your app’s own logic using the published Selected latitude and Selected longitude, not by this element. Your stored addresses need coordinates of their own for such a comparison to be possible.