Stay organized with collections Save and categorize content based on your preferences.
LocalContextMapView classgoogle.maps.localContext.LocalContextMapView
class
Deprecated: Local Context is deprecated, and no longer recommended for new websites. The feature will continue to work, and 12 months notice will be given before support is discontinued. If you are interested in building a Local Context-like experience yourself, we suggest that you check out the "Neighborhood Discovery" solution in Quick Builder or use the Places Library, Maps JavaScript API. Code samples and codelabs for the Places Library can help you.
Notice: Available only in the v=beta channel.
Shows a Local Context experience with a Map
.
This class implements LocalContextMapViewOptions
.
Access by calling const {LocalContextMapView} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
addListener
addListener(eventName, handler)
eventName
: string
handler
: Function
MapsEventListener
Adds the given listener function to the given event name.
hidePlaceDetailsView
hidePlaceDetailsView()
Parameters: None
Return Value: None
Hides the place details.
search
search()
Parameters: None
Return Value: None
Searches for places to show the user based on the current maxPlaceCount
, placeTypePreferences
, locationRestriction
, and locationBias
.
error
function(event)
event
: ErrorEvent
This event is fired if there is an error while performing search.
placedetailsviewhidestart
function()
Arguments: None
This event is fired before the place details begins animating out.
placedetailsviewshowstart
function()
Arguments: None
This event is fired before the place details begins animating in.
LocalContextMapViewOptions interfacegoogle.maps.localContext.LocalContextMapViewOptions
interface
Notice: Available only in the v=beta channel.
Options for constructing a LocalContextMapView
, or accessing an existing LocalContextMapView
.
maxPlaceCount
Type: number
The maximum number of places to show. When this parameter is 0, the Local Context Library does not load places. [0,24]
placeTypePreferences
Type: Array<PlaceTypePreference>
The types of places to search for (up to 10). The type Iterable<string|PlaceTypePreference>
is also accepted, but is only supported in browsers which natively support JavaScript Symbols.
directionsOptions optional
Type: MapDirectionsOptions|MapDirectionsOptionsLiteral optional
Options for customizing directions. If not set, directions and distance will be disabled.
element optional
Type: HTMLElement|SVGElement optional
This Field is read-only. The DOM Element backing the view.
locationBias optional
Type: LocationBias optional
Default: null
A soft boundary or hint to use when searching for places.
locationRestriction optional
Type: LocationRestriction optional
Bounds to constrain search results. If not specified, results will be constrained to the map viewport.
map optional
Type: Map optional
An already instantiated
Map
instance. If passed in, the map will be moved into the LocalContextMapView's DOM, and will
notbe re-styled. The element associated with the Map may also have styles and classes applied to it by the
LocalContextMapView
.
pinOptionsSetup optional
Type: (function({
isSelected:boolean,
isHighlighted:boolean
}): (PinOptions optional))|PinOptions optional
Configure the place marker icon based on the icon state. Invoked whenever the input to the callback changes. Pass a function to dynamically override the default setup when the LocalContextMapView draws the place marker. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used, and errors will be logged to the console).
placeChooserViewSetup optional
Type: (function({
defaultLayoutMode:PlaceChooserLayoutMode,
defaultPosition:PlaceChooserPosition optional
}): (PlaceChooserViewSetupOptions optional))|PlaceChooserViewSetupOptions optional
Overrides the setup of the place chooser view. Pass a function to dynamically override the default setup when the LocalContextMapView might change its layout due to resizing. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used instead, and errors will be logged to the console). Errors detected at construction will cause errors to be thrown synchronously.
placeDetailsViewSetup optional
Type: (function({
defaultLayoutMode:PlaceDetailsLayoutMode,
defaultPosition:PlaceDetailsPosition optional
}): (PlaceDetailsViewSetupOptions optional))|PlaceDetailsViewSetupOptions optional
Overrides the setup of the place details view. Pass a function to dynamically override the default setup when the LocalContextMapView might change its layout due to resizing. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used, and errors will be logged to the console). Errors detected at construction will cause errors to be thrown synchronously.
PlaceTypePreference typedefgoogle.maps.localContext.PlaceTypePreference
typedef
Notice: Available only in the v=beta channel.
A place type to search for, and the weight to use. If weight
is omitted the library will determine default weights, which may change and improve over time.
{
type:string,
weight:number optional
}
google.maps.localContext.PinOptions
interface
Notice: Available only in the v=beta channel.
Options for customizing a pin marker.
Propertiesbackground optional
Type: string optional
The color of the icon's shape, can be any valid CSS color.
glyphColor optional
Type: string optional
The color of the icon's glyph, can be any valid CSS color.
scale optional
Type: number optional
The scale of the icon. The value is absolute, not relative to the default sizes in each state.
PlaceChooserPosition constantsgoogle.maps.localContext.PlaceChooserPosition
constants
Notice: Available only in the v=beta channel.
Display positions for the place chooser.
Access by calling const {PlaceChooserPosition} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
BLOCK_END
Place chooser is displayed on a line below the map extending to the end of the container. INLINE_END
Place chooser is displayed inline with the map at the end of the line. (In a left-to-right language this means that the place chooser is to the right of the map.) INLINE_START
Place chooser is displayed inline with the map at the start of the line. (In a left-to-right language this means that the place chooser is to the left of the map.) PlaceDetailsPosition constants
google.maps.localContext.PlaceDetailsPosition
constants
Notice: Available only in the v=beta channel.
Display positions for the place details.
Access by calling const {PlaceDetailsPosition} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
INLINE_END
Place details is displayed inline with the map at the end of the line. (In a left-to-right language this means that the place details is to the right of the map.) INLINE_START
Place details is displayed inline with the map at the start of the line. (In a left-to-right language this means that the place details is to the left of the map.)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-16 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4