LocalContextMapView class
google.maps.localContext.LocalContextMapView
class
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.
Constructor | |
---|---|
LocalContextMapView |
LocalContextMapView(options) Parameters:
|
Properties | |
---|---|
directionsOptions |
Type:
MapDirectionsOptions|MapDirectionsOptionsLiteral optional |
element optional |
Type:
HTMLElement|SVGElement optional This Field is read-only. The DOM Element backing the view. |
isTransitioningMapBounds |
Type:
boolean Is set to true before LocalContextMapView begins changing the bounds of the inner Map , and set to false after LocalContextMapView finishes changing the bounds of the inner Map . (Not set when layout mode changes happen due to responsive resizing.) |
locationBias |
Type:
LocationBias optional See LocalContextMapViewOptions.locationBias . Changing this property on the LocalContextMapView may trigger a new search. |
locationRestriction |
Type:
LocationRestriction optional See LocalContextMapViewOptions.locationRestriction . Changing this property on the LocalContextMapView may trigger a new search. |
maxPlaceCount |
Type:
number See LocalContextMapViewOptions.maxPlaceCount . Changing this property on the LocalContextMapView may trigger a new search. |
placeTypePreferences |
Type:
Array<PlaceTypePreference> See LocalContextMapViewOptions.placeTypePreferences . Changing this property on the LocalContextMapView may trigger a new search. Iterable<string|PlaceTypePreference> is also accepted. |
Inherited:
map ,
pinOptionsSetup ,
placeChooserViewSetup ,
placeDetailsViewSetup
|
Methods | |
---|---|
addListener |
addListener(eventName, handler) Parameters:
Return Value:
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 . |
Events | |
---|---|
error |
function(event) Arguments:
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 interface
google.maps.localContext.LocalContextMapViewOptions
interface
Options for constructing a LocalContextMapView
, or accessing an existing LocalContextMapView
.
Properties | |
---|---|
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 not be re-styled. The element associated with the Map may also have styles and classes applied to it by the LocalContextMapView . |
pinOptionsSetup optional |
Type:
(function({ 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({ 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({ 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 typedef
google.maps.localContext.PlaceTypePreference
typedef
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
}
MapDirectionsOptions class
google.maps.localContext.MapDirectionsOptions
class
Provides settings for directions with a LocalContextMapView
.
This class implements
MapDirectionsOptionsLiteral
.
Access by calling const {MapDirectionsOptions} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
Properties | |
---|---|
Inherited:
origin
|
Methods | |
---|---|
addListener |
addListener(eventName, handler) Parameters:
Return Value:
MapsEventListener Adds the given listener function to the given event name. |
MapDirectionsOptionsLiteral interface
google.maps.localContext.MapDirectionsOptionsLiteral
interface
Object literals are accepted in place of MapDirectionsOptions
objects, as a convenience, in many places. These are converted to MapDirectionsOptions
objects when the Maps API encounters them.
Properties | |
---|---|
origin |
Type:
LatLng|LatLngLiteral Origin for directions and distance. |
PinOptions interface
google.maps.localContext.PinOptions
interface
Options for customizing a pin marker.
Properties | |
---|---|
background 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. |
PlaceChooserViewSetupOptions interface
google.maps.localContext.PlaceChooserViewSetupOptions
interface
Setup options for the place chooser. Read more about setting layout and visibility.
Properties | |
---|---|
layoutMode optional |
Type:
PlaceChooserLayoutMode optional |
position optional |
Type:
PlaceChooserPosition optional Ignored when layoutMode:HIDDEN . If not passed, a position will be determined automatically based on the layoutMode . |
PlaceChooserLayoutMode constants
google.maps.localContext.PlaceChooserLayoutMode
constants
Layout modes for the place chooser.
Access by calling const {PlaceChooserLayoutMode} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
Constants | |
---|---|
HIDDEN |
Place chooser is hidden. |
SHEET |
Place chooser is shown as a sheet. |
PlaceChooserPosition constants
google.maps.localContext.PlaceChooserPosition
constants
Display positions for the place chooser.
Access by calling const {PlaceChooserPosition} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
Constants | |
---|---|
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.) |
PlaceDetailsViewSetupOptions interface
google.maps.localContext.PlaceDetailsViewSetupOptions
interface
Setup options for the place details. Read more about setting layout and visibility.
Properties | |
---|---|
hidesOnMapClick optional |
Type:
boolean optional |
layoutMode optional |
Type:
PlaceDetailsLayoutMode optional |
position optional |
Type:
PlaceDetailsPosition optional Ignored when layoutMode:INFO_WINDOW . If not passed, a position will be determined automatically based on the layoutMode . |
PlaceDetailsLayoutMode constants
google.maps.localContext.PlaceDetailsLayoutMode
constants
Layout modes for the place details.
Access by calling const {PlaceDetailsLayoutMode} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
Constants | |
---|---|
INFO_WINDOW |
Place details is displayed in an InfoWindow . |
SHEET |
Place details is displayed in a sheet. |
PlaceDetailsPosition constants
google.maps.localContext.PlaceDetailsPosition
constants
Display positions for the place details.
Access by calling const {PlaceDetailsPosition} = await google.maps.importLibrary("localContext")
. See Libraries in the Maps JavaScript API.
Constants | |
---|---|
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.) |