Google Maps
This plugin uses the native Google Maps SDK Note: As of Ionic native 4.0, this using the 2.0 version of the google maps plugin. Please make sure your plugin is updated
Repo: https://github.com/mapsplugin/cordova-plugin-googlemaps
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE" $ npm install --save @ionic-native/google-maps
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import {
GoogleMaps,
GoogleMap,
GoogleMapsEvent,
GoogleMapOptions,
CameraPosition,
MarkerOptions,
Marker
} from '@ionic-native/google-maps';
import { Component } from "@angular/core/";
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
map: GoogleMap;
constructor() { }
ionViewDidLoad() {
this.loadMap();
}
loadMap() {
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: 43.0741904,
lng: -89.3809802
},
zoom: 18,
tilt: 30
}
};
this.map = GoogleMaps.create('map_canvas', mapOptions);
// Wait the MAP_READY before using any methods.
this.map.one(GoogleMapsEvent.MAP_READY)
.then(() => {
console.log('Map is ready!');
// Now you can use all methods safely.
this.map.addMarker({
title: 'Ionic',
icon: 'blue',
animation: 'DROP',
position: {
lat: 43.0741904,
lng: -89.3809802
}
})
.then(marker => {
marker.on(GoogleMapsEvent.MARKER_CLICK)
.subscribe(() => {
alert('clicked');
});
});
});
}
}
Static Members
create(element, options)
Creates a new GoogleMap instance
Param | Type | Details |
---|---|---|
element |
string |HTMLElement
|
Element ID or reference to attach the map to |
options |
GoogleMapOptions
|
[options] Options |
Returns: GoogleMap
GoogleMap
Instance Members
setDiv(domNode)
Changes the map div
Param | Type | Details |
---|---|---|
domNode |
HTMLElement |string
|
[options] If you want to display the map in an html element, you need to specify an element or id. If omit this argument, the map is detached from webview. |
getDiv()
Returns the map HTML element
Returns: HTMLElement
setMapTypeId(mapTypeId)
Changes the map type id
Param | Type | Details |
---|---|---|
mapTypeId |
string
|
animateCamera()
Moves the camera with animation
Returns: Promise<any>
animateCameraZoomIn()
Zooming in the camera with animation
Returns: Promise<any>
animateCameraZoomOut()
Zooming out the camera with animation
Returns: Promise<any>
moveCamera()
Moves the camera without animation
Returns: Promise<any>
moveCameraZoomIn()
Zooming in the camera without animation
Returns: Promise<any>
moveCameraZoomOut()
Zooming out the camera without animation
Returns: Promise<any>
getCameraPosition()
Get the position of the camera.
Returns: CameraPosition
getCameraTarget()
Get the current camera target position
Returns: Promise<CameraPosition>
getCameraZoom()
Get the current camera zoom level
Returns: number
getCameraBearing()
Get the current camera bearing
Returns: number
getCameraTilt()
Get the current camera tilt (view angle)
Returns: number
setCameraTarget(latLng)
Set the center position of the camera view
Param | Type | Details |
---|---|---|
latLng |
ILatLng |Array.<ILatLng>
|
setCameraZoom(zoomLevel)
Set zoom level of the camera
Param | Type | Details |
---|---|---|
zoomLevel |
number
|
Zoom level |
setCameraTilt(tiltLevel)
Set the camera view angle
Param | Type | Details |
---|---|---|
tiltLevel |
number
|
Tilt level |
setCameraBearing(bearing)
Set camera bearing
Param | Type | Details |
---|---|---|
bearing |
any
|
panBy(x, y)
Change the center of the map by the given distance in pixels
Param | Type | Details |
---|---|---|
x |
any
|
|
y |
any
|
getVisibleRegion()
Get the current visible region (southWest and northEast)
Returns: VisibleRegion
getMyLocation()
Get the current device location
Returns: Promise<MyLocation>
setClickable(isClickable)
Set false to ignore all clicks on the map
Param | Type | Details |
---|---|---|
isClickable |
boolean
|
remove()
Destroy a map completely
Returns: Promise<any>
clear()
Remove all overlays, such as marker
Returns: Promise<any>
fromLatLngToPoint()
Convert the unit from LatLng to the pixels from the left/top of the map div
Returns: Promise<any>
fromPointToLatLng()
Convert the unit from the pixels from the left/top to the LatLng
Returns: Promise<LatLng>
setMyLocationEnabled(enabled)
Set true if you want to show the MyLocation control (blue dot)
Param | Type | Details |
---|---|---|
enabled |
boolean
|
setMyLocationButtonEnabled(enabled)
Set true if you want to show the MyLocation button
Param | Type | Details |
---|---|---|
enabled |
boolean
|
getFocusedBuilding()
Get the currently focused building
Returns: Promise<any>
setIndoorEnabled(enabled)
Set true if you want to show the indoor map
Param | Type | Details |
---|---|---|
enabled |
boolean
|
setTrafficEnabled(enabled)
Set true if you want to show the traffic layer
Param | Type | Details |
---|---|---|
enabled |
boolean
|
setCompassEnabled(enabled)
Set true if you want to show the compass button
Param | Type | Details |
---|---|---|
enabled |
boolean
|
setAllGesturesEnabled(enabled)
Sets the preference for whether all gestures should be enabled or disabled
Param | Type | Details |
---|---|---|
enabled |
boolean
|
setVisible(visible)
Set visibility of the map
Param | Type | Details |
---|---|---|
visible |
boolean
|
setPadding(top, right, left, bottom)
Adjust the map padding (same as CSS padding rule)
Param | Type | Details |
---|---|---|
top |
number
|
|
right |
number
|
|
left |
number
|
|
bottom |
number
|
setOptions(options)
Set options
Param | Type | Details |
---|---|---|
options |
addMarker(options)
Adds a marker
Param | Type | Details |
---|---|---|
options |
MarkerOptions
|
options |
Returns: Promise<Marker | any>
addMarkerCluster(options)
Adds a marker cluster
Param | Type | Details |
---|---|---|
options |
MarkerClusterOptions
|
options |
Returns: Promise<MarkerCluster | any>
addCircle(options)
Adds a circle
Param | Type | Details |
---|---|---|
options |
CircleOptions
|
options |
Returns: Promise<Circle | any>
addPolygon(options)
Adds a polygon
Param | Type | Details |
---|---|---|
options |
PolygonOptions
|
options |
Returns: Promise<Polygon | any>
addPolyline(options)
Adds a polyline
Param | Type | Details |
---|---|---|
options |
PolylineOptions
|
options |
Returns: Promise<Polyline | any>
addTileOverlay(options)
Adds a tile overlay
Param | Type | Details |
---|---|---|
options |
TileOverlayOptions
|
options |
Returns: Promise<TileOverlay | any>
addGroundOverlay(options)
Adds a ground overlay
Param | Type | Details |
---|---|---|
options |
GroundOverlayOptions
|
options |
Returns: Promise<GroundOverlay | any>
addKmlOverlay(options)
Adds a kml overlay
Param | Type | Details |
---|---|---|
options |
KmlOverlayOptions
|
options |
Returns: Promise<KmlOverlay | any>
toDataURL(options)
Returns the base64 encoded screen capture of the map.
Param | Type | Details |
---|---|---|
options |
ToDataUrlOptions
|
[options] options |
Returns: Promise<string>
Circle
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setCenter(latLng)
Change the center position.
Param | Type | Details |
---|---|---|
latLng |
ILatLng
|
getCenter()
Return the current center position
Returns: ILatLng
getRadius()
Return the current circle radius.
Returns: number
setRadius(radius)
Change the circle radius.
Param | Type | Details |
---|---|---|
radius |
number
|
setFillColor(color)
Change the filling color (inner color).
Param | Type | Details |
---|---|---|
color |
string
|
getFillColor()
Return the current circle filling color (inner color).
Returns: string
setStrokeWidth(strokeWidth)
Change the stroke width.
Param | Type | Details |
---|---|---|
strokeWidth |
number
|
getStrokeWidth()
Return the current circle stroke width (unit: pixel).
Returns: number
setStrokeColor(strokeColor)
Change the stroke color (outter color).
Param | Type | Details |
---|---|---|
strokeColor |
string
|
getStrokeColor()
Return the current circle stroke color (outer color).
Returns: string
setClickable(clickable)
Change clickablity of the circle.
Param | Type | Details |
---|---|---|
clickable |
boolean
|
getClickable()
Return true if the circle is clickable.
Returns: boolean
setZIndex(zIndex)
Change the circle zIndex order.
Param | Type | Details |
---|---|---|
zIndex |
number
|
getZIndex()
Return the current circle zIndex.
Returns: number
remove()
Remove the circle.
getBounds()
Return the latLngBounds (rectangle) that contains the circle.
Returns: LatLngBounds
setVisible(visible)
Set circle visibility
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Returns a boolean that indicates whether the circle is visible
Returns: boolean
Encoding
Static Members
decodePath(encoded, precision?)
Decodes an encoded path string into a sequence of LatLngs.
Param | Type | Details |
---|---|---|
encoded |
string
|
an encoded path string |
precision? |
number
|
default: 5 |
Returns: ILatLng[]
encodePath(path)
Encodes a sequence of LatLngs into an encoded path string.
Param | Type | Details |
---|---|---|
path |
Array.<ILatLng> |BaseArrayClass.<ILatLng>
|
a sequence of LatLngs |
Returns: string
Environment
Static Members
getLicenseInfo()
Get the open source software license information for Google Maps SDK for iOS.
Returns: Promise<any>
setBackgroundColor(color)
Specifies the background color of the app.
Param | Type | Details |
---|---|---|
color |
Geocoder
Static Members
geocode(request)
Converts position to address and vice versa
Param | Type | Details |
---|---|---|
request |
GeocoderRequest
|
Request object with either an address or a position |
Returns: Promise<GeocoderResult[] | BaseArrayClass<GeocoderResult>>
GroundOverlay
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setBounds(bounds)
Change the bounds of the GroundOverlay
Param | Type | Details |
---|---|---|
bounds |
ILatLng[]
|
setBearing(bearing)
Change the bearing of the ground overlay
Param | Type | Details |
---|---|---|
bearing |
number
|
getBearing()
Return the current bearing value
setImage(image)
Change the image of the ground overlay
Param | Type | Details |
---|---|---|
image |
string
|
URL of image |
setOpacity(opacity)
Change the opacity of the ground overlay from 0.0 to 1.0
Param | Type | Details |
---|---|---|
opacity |
number
|
getOpacity()
Return the current opacity
Returns: number
setClickable(clickable)
Change clickablity of the ground overlay
Param | Type | Details |
---|---|---|
clickable |
boolean
|
getClickable()
Return true if the ground overlay is clickable
Returns: boolean
setVisible(visible)
Change visibility of the ground overlay
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Return true if the ground overlay is visible
Returns: boolean
setZIndex(index)
Change the ground overlay zIndex order
Param | Type | Details |
---|---|---|
index |
number
|
getZIndex()
Return the current ground overlay zIndex
Returns: number
remove()
Remove the ground overlay
HtmlInfoWindow
Instance Members
setBackgroundColor(color)
Change the backgroundColor
Param | Type | Details |
---|---|---|
color |
string
|
setContent(content, cssOptions?)
Set your HTML contents.
Param | Type | Details |
---|---|---|
content |
any
|
String containing text or HTML element |
cssOptions? |
any
|
CSS styles for the container element of HTMLInfoWindow |
open(marker)
Open the htmlInfoWindow
Param | Type | Details |
---|---|---|
marker |
Marker
|
close()
Close the htmlInfoWindow
Geocoder
Static Members
geocode(request)
Converts position to address and vice versa
Param | Type | Details |
---|---|---|
request |
GeocoderRequest
|
Request object with either an address or a position |
Returns: Promise<GeocoderResult[] | BaseArrayClass<GeocoderResult>>
LatLng
Instance Members
lat()
lng()
equals()
toString()
toUrlValue()
LatLngBounds
Instance Members
northeast()
southwest()
type()
toString()
Converts to string
Returns: string
toUrlValue(precision)
Returns a string of the form “lat_sw,lng_sw,lat_ne,lng_ne” for this bounds, where “sw” corresponds to the southwest corner of the bounding box, while “ne” corresponds to the northeast corner of that box.
Param | Type | Details |
---|---|---|
precision |
number
|
Returns: string
extend(LatLng)
Extends this bounds to contain the given point.
Param | Type | Details |
---|---|---|
LatLng |
ILatLng
|
contains(LatLng)
Returns true if the given lat/lng is in this bounds.
Param | Type | Details |
---|---|---|
LatLng |
ILatLng
|
getCenter()
Computes the center of this LatLngBounds
Returns: LatLng
Marker
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setPosition(latLng)
Set the marker position.
Param | Type | Details |
---|---|---|
latLng |
ILatLng
|
getPosition()
Return the marker position.
Returns: ILatLng
showInfoWindow()
Show the normal infoWindow of the marker.
hideInfoWindow()
Hide the normal infoWindow of the marker.
setAnimation(animation)
Specify the animation either DROP
or BOUNCE
Param | Type | Details |
---|---|---|
animation |
string
|
setDisableAutoPan(disableAutoPan)
Set true if you do not want to move the map when you click on the marker.
Param | Type | Details |
---|---|---|
disableAutoPan |
boolean
|
setVisible(visible)
Set false if you want to hide the marker.
Param | Type | Details |
---|---|---|
visible |
isVisible()
Return true if the marker is visible
setTitle(title)
Change title of the normal infoWindow.
Param | Type | Details |
---|---|---|
title |
string
|
getTitle()
Return the title strings.
Returns: string
setSnippet(snippet)
Change snippet of the normal infoWindow.
Param | Type | Details |
---|---|---|
snippet |
string
|
getSnippet()
Return the snippet strings.
Returns: string
setOpacity(alpha)
Change the marker opacity from 0.0 to 1.0.
Param | Type | Details |
---|---|---|
alpha |
number
|
Opacity |
getOpacity()
Return the marker opacity.
Returns: number
Opacity
remove()
Remove the marker.
setIconAnchor(x, y)
Change the info window anchor. This defaults to 50% from the left of the image and at the bottom of the image.
Param | Type | Details |
---|---|---|
x |
number
|
Distance from left of the icon image in pixels. |
y |
number
|
Distance from top of the icon image in pixels. |
setInfoWindowAnchor(x, y)
Change the info window anchor. This defaults to 50% from the left of the image and at the top of the image.
Param | Type | Details |
---|---|---|
x |
number
|
Distance from left of the icon image in pixels. |
y |
number
|
Distance from top of the icon image in pixels. |
isInfoWindowShown()
Return true if the infoWindow is shown on the marker
Returns: boolean
getHashCode()
Return the marker hash code.
Returns: string
Marker hash code
setZIndex(y)
Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays.
Param | Type | Details |
---|---|---|
y |
number
|
z-index |
getZIndex()
Get z-index
Returns: number
setDraggable(draggable)
Set true if you allow all users to drag the marker.
Param | Type | Details |
---|---|---|
draggable |
boolean
|
isDraggable()
Return true if the marker drag is enabled.
Returns: boolean
setFlat(flat)
Set true if you want to be flat marker.
Param | Type | Details |
---|---|---|
flat |
boolean
|
setIcon(icon)
Change icon url and/or size
Param | Type | Details |
---|---|---|
icon |
setRotation(rotation)
Set the marker rotation angle.
Param | Type | Details |
---|---|---|
rotation |
number
|
getRotation()
Return the marker rotation angle.
Returns: number
MarkerCluster
Instance Members
getId()
Return the ID of instance.
Returns: string
addMarker(marker, skipRedraw?)
Add one marker location
Param | Type | Details |
---|---|---|
marker |
MarkerOptions
|
one location |
skipRedraw? |
boolean
|
marker cluster does not redraw the marker cluster if true. |
addMarkers(markers)
Add marker locations
Param | Type | Details |
---|---|---|
markers |
MarkerOptions[]
|
multiple locations |
remove()
Remove the marker cluster
getMap()
Return the map instance.
Returns: GoogleMap
Polygon
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setPoints(points)
Change the polygon points.
Param | Type | Details |
---|---|---|
points |
ILatLng[]
|
getPoints()
Return an instance of the BaseArrayClass. You can modify the points.
Returns: BaseArrayClass<ILatLng>
setHoles(holes)
Change the polygon holes.
Param | Type | Details |
---|---|---|
holes |
ILatLng[][]
|
getHoles()
Return an instance of the BaseArrayClass. You can modify the holes.
Returns: BaseArrayClass<ILatLng[]>
setFillColor(fillColor)
Change the filling color (inner color)
Param | Type | Details |
---|---|---|
fillColor |
string
|
getFillColor()
Return the current polygon filling color (inner color).
Returns: string
setStrokeColor(strokeColor)
Change the stroke color (outer color)
Param | Type | Details |
---|---|---|
strokeColor |
string
|
getStrokeColor()
Return the current polygon stroke color (outer color)
Returns: string
setClickable(clickable)
Change clickablity of the polygon
Param | Type | Details |
---|---|---|
clickable |
boolean
|
getClickable()
Return true if the polygon is clickable
setVisible(visible)
Change visibility of the polygon
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Return true if the polygon is visible
Returns: boolean
setZIndex(zIndex)
Change the polygon zIndex order.
Param | Type | Details |
---|---|---|
zIndex |
number
|
getZIndex()
Return the current polygon zIndex
Returns: number
remove()
Remove the polygon.
setStrokeWidth()
Change the polygon stroke width
getStrokeWidth()
Return the polygon stroke width
setGeodesic(geodesic)
When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth.
Param | Type | Details |
---|---|---|
geodesic |
boolean
|
getGeodesic()
Return true if the polygon is geodesic.
Returns: boolean
Polyline
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setPoints(points)
Change the polyline points.
Param | Type | Details |
---|---|---|
points |
ILatLng[]
|
getPoints()
Return an instance of the BaseArrayClass You can modify the points.
Returns: BaseArrayClass<ILatLng>
setGeoDesic(geoDesic)
When true, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth.
Param | Type | Details |
---|---|---|
geoDesic |
boolean
|
getGeodesic()
Return true if the polyline is geodesic
setVisible(visible)
Change visibility of the polyline
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Return true if the polyline is visible
Returns: boolean
setClickable(clickable)
Change clickablity of the polyline
Param | Type | Details |
---|---|---|
clickable |
boolean
|
getClickable()
Return true if the polyline is clickable
Returns: boolean
setStrokeColor(strokeColor)
Change the polyline color
Param | Type | Details |
---|---|---|
strokeColor |
string
|
getStrokeColor()
Return the current polyline color
Returns: string
setStrokeWidth(strokeWidth)
Change the polyline stroke width
Param | Type | Details |
---|---|---|
strokeWidth |
number
|
getStrokeWidth()
Return the current stroke width (unit: pixel).
Returns: number
setZIndex(index)
Change the polyline zIndex order.
Param | Type | Details |
---|---|---|
index |
number
|
getZIndex()
Return the current polyline zIndex
Returns: number
remove()
Remove the polyline
Spherical
Static Members
computeDistanceBetween(locationA, locationB)
Returns the distance, in meters, between two LatLngs.
Param | Type | Details |
---|---|---|
locationA |
ILatLng
|
|
locationB |
ILatLng
|
Returns: number
computeOffset(from, distance, heading)
Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north)
Param | Type | Details |
---|---|---|
from |
ILatLng
|
|
distance |
number
|
|
heading |
number
|
Returns: LatLng
computeOffsetOrigin(to, distance, heading)
Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.
Param | Type | Details |
---|---|---|
to |
ILatLng
|
The destination LatLng. |
distance |
number
|
The distance travelled, in meters. |
heading |
number
|
The heading in degrees clockwise from north. |
Returns: LatLng
computeLength(path)
Returns the length of the given path.
Param | Type | Details |
---|---|---|
path |
Array.<ILatLng> |BaseArrayClass.<ILatLng>
|
Returns: number
computeArea(path)
Returns the area of a closed path. The computed area uses the same units as the radius.
Param | Type | Details |
---|---|---|
path |
Array.<ILatLng> |BaseArrayClass.<ILatLng>
|
. |
Returns: number
computeSignedArea(path)
Returns the signed area of a closed path. The signed area may be used to determine the orientation of the path.
Param | Type | Details |
---|---|---|
path |
Array.<ILatLng> |BaseArrayClass.<ILatLng>
|
. |
Returns: number
computeHeading(from, to)
Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range (-180,180).
Param | Type | Details |
---|---|---|
from |
ILatLng
|
|
to |
ILatLng
|
Returns: number
interpolate(from, to, fraction)
Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng.
Param | Type | Details |
---|---|---|
from |
ILatLng
|
The LatLng from which to start. |
to |
ILatLng
|
The LatLng toward which to travel. |
fraction |
number
|
A fraction of the distance to travel from 0.0 to 1.0 . |
Returns: LatLng
KmlOverlay
Instance Members
getDefaultViewport()
Returns the viewport to contains all overlays
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setVisible(visible)
Change visibility of the polyline
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Return true if the polyline is visible
Returns: boolean
setClickable(clickable)
Change clickablity of the KmlOverlay
Param | Type | Details |
---|---|---|
clickable |
boolean
|
getClickable()
Return true if the KmlOverlay is clickable
Returns: boolean
remove()
Remove the KmlOverlay
Poly
Static Members
containsLocation(location, path)
Returns true if the speicified location is in the polygon path
Param | Type | Details |
---|---|---|
location |
ILatLng
|
|
path |
ILatLng[]
|
Returns: boolean
isLocationOnEdge(location, path)
Returns true if the speicified location is on the polyline path
Param | Type | Details |
---|---|---|
location |
ILatLng
|
|
path |
ILatLng[]
|
Returns: boolean
TileOverlay
Instance Members
getId()
Return the ID of instance.
Returns: string
getMap()
Return the map instance.
Returns: GoogleMap
setFadeIn(fadeIn)
Set whether the tiles should fade in.
Param | Type | Details |
---|---|---|
fadeIn |
boolean
|
getFadeIn()
Get whether the tiles should fade in
Returns: boolean
setZIndex(zIndex)
Set the zIndex of the tile overlay
Param | Type | Details |
---|---|---|
zIndex |
number
|
getZIndex()
Return the zIndex of the tile overlay
Returns: number
setOpacity(opacity)
Set the opacity of the tile overlay
Param | Type | Details |
---|---|---|
opacity |
number
|
getOpacity()
Return the opacity of the tile overlay
Returns: number
setVisible(visible)
Set false if you want to hide
Param | Type | Details |
---|---|---|
visible |
boolean
|
getVisible()
Return true if the tile overlay is visible
Returns: boolean
getTileSize()
Get tile size
remove()
Remove the tile overlay
BaseClass
Instance Members
addEventListener(eventName)
Adds an event listener.
Param | Type | Details |
---|---|---|
eventName |
string
|
event name you want to observe. |
Returns: Observable<any>
addListenerOnce(eventName)
Adds an event listener that works once.
Param | Type | Details |
---|---|---|
eventName |
string
|
event name you want to observe. |
Returns: Promise<any>
get(key)
Gets a value
Param | Type | Details |
---|---|---|
key |
any
|
set(key, value, noNotify)
Sets a value
Param | Type | Details |
---|---|---|
key |
string
|
The key name for the value. |
value |
any
|
|
noNotify |
boolean
|
[options] True if you want to prevent firing the |
bindTo(key, target, targetKey?, noNotify?)
Bind a key to another object
Param | Type | Details |
---|---|---|
key |
string
|
The property name you want to observe. |
target |
any
|
The target object you want to observe. |
targetKey? |
string
|
[options] The property name you want to observe. If you omit this, the |
noNotify? |
boolean
|
[options] True if you want to prevent |
on(key)
Alias of addEventListener
Param | Type | Details |
---|---|---|
key |
string
|
The property name you want to observe. |
Returns: Observable<any>
one(key)
Alias of addEventListenerOnce
Param | Type | Details |
---|---|---|
key |
string
|
The property name you want to observe. |
Returns: Promise<any>
empty()
Clears all stored values
trigger(eventName, parameters)
Dispatch event.
Param | Type | Details |
---|---|---|
eventName |
string
|
Event name |
parameters |
any
|
[options] The data you want to pass to event listerners. |
destroy()
Executes off() and empty()
removeEventListener(eventName, listener)
Remove event listener(s)
The removeEventListener()
has three usages:
- removeEventListener(“eventName”, listenerFunction); This removes one particular event listener
- removeEventListener(“eventName”); This removes the event listeners that added for the event name.
- removeEventListener(); This removes all listeners.
Param | Type | Details |
---|---|---|
eventName |
string
|
[options] Event name |
listener |
Function
|
[options] Event listener |
off(eventName, listener)
Alias of removeEventListener
Param | Type | Details |
---|---|---|
eventName |
string
|
[options] Event name |
listener |
Function
|
[options] Event listener |
BaseArrayClass
Instance Members
empty(noNotify?)
Removes all elements from the array.
Param | Type | Details |
---|---|---|
noNotify? |
boolean
|
[options] Set true to prevent remove_at events. |
forEach(fn)
Iterate over each element, calling the provided callback.
Param | Type | Details |
---|---|---|
fn |
Function
|
forEachAsync(fn)
Iterate over each element, calling the provided callback.
Param | Type | Details |
---|---|---|
fn |
Function
|
Returns: Promise<any>
map(fn)
Iterate over each element, then return a new value. Then you can get the results of each callback.
Param | Type | Details |
---|---|---|
fn |
Function
|
Returns: Array<Object>
returns a new array with the results
mapAsync(fn, callback)
Iterate over each element, calling the provided callback. Then you can get the results of each callback.
Param | Type | Details |
---|---|---|
fn |
Function
|
|
callback |
Function
|
Returns: Promise<any>
returns a new array with the results
mapSeries(fn, callback)
Same as mapAsync
, but keep the execution order
Param | Type | Details |
---|---|---|
fn |
Function
|
|
callback |
Function
|
Returns: Promise<any>
returns a new array with the results
filter(fn)
The filter() method creates a new array with all elements that pass the test implemented by the provided function.
Param | Type | Details |
---|---|---|
fn |
Function
|
Returns: Array<Object>
returns a new filtered array
filterAsync(fn, callback)
The filterAsync() method creates a new array with all elements that pass the test implemented by the provided function.
Param | Type | Details |
---|---|---|
fn |
Function
|
|
callback |
Function
|
Returns: Promise<any>
returns a new filtered array
getArray()
Returns a reference to the underlying Array.
Returns: Array<Object>
getAt(index)
Returns the element at the specified index.
Param | Type | Details |
---|---|---|
index |
number
|
Returns: Object
getLength()
Returns the number of the elements.
Returns: number
indexOf(element)
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
Param | Type | Details |
---|---|---|
element |
Object
|
Returns: number
reverse()
The reverse() method reverses an array in place.
sort()
The sort() method sorts the elements of an array in place and returns the array.
insertAt(index, element, noNotify?)
Inserts an element at the specified index.
Param | Type | Details |
---|---|---|
index |
number
|
|
element |
Object
|
|
noNotify? |
boolean
|
[options] Set true to prevent insert_at events. |
Returns: Object
pop(noNotify?)
Removes the last element of the array and returns that element.
Param | Type | Details |
---|---|---|
noNotify? |
boolean
|
[options] Set true to prevent remove_at events. |
Returns: Object
push(element, noNotify?)
Adds one element to the end of the array and returns the new length of the array.
Param | Type | Details |
---|---|---|
element |
object
|
|
noNotify? |
boolean
|
Set true to prevent insert_at events. |
removeAt(index, noNotify?)
Removes an element from the specified index.
Param | Type | Details |
---|---|---|
index |
number
|
|
noNotify? |
boolean
|
[options] Set true to prevent remove_at events. |
setAt(index, element, noNotify?)
Sets an element at the specified index.
Param | Type | Details |
---|---|---|
index |
number
|
|
element |
object
|
|
noNotify? |
boolean
|
[options] Set true to prevent set_at events. |
GoogleMapOptions
Param | Type | Details |
---|---|---|
mapType |
MapType
|
mapType [options] (optional) |
controls |
GoogleMapControlOptions
|
controls [options] (optional) |
gestures |
GoogleMapGestureOptions
|
gestures [options] (optional) |
styles |
any[]
|
Map styles [options] (optional) |
camera |
CameraPosition<any>
|
Initial camera position [options] (optional) |
preferences |
GoogleMapPreferenceOptions
|
preferences [options] (optional) |
CameraPosition
</tbody> </table>CircleOptions
Param | Type | Details |
---|---|---|
target |
T
|
The center location of the camera view. [usage 1] let cameraPos: CameraPosition [usage 2] The zoom property is ignored when you specify multiple position let cameraPos: CameraPosition<ILatLng[]> = { target: [ {lat: ..., lng: ...}, {lat: ..., lng: ...}, {lat: ..., lng: ...} ] } (optional) </td> </tr> |
tilt |
number
|
View angle (optional) |
zoom |
number
|
Zoom level (optional) |
bearing |
number
|
Map orientation (optional) |
duration |
number
|
The duration of animation in milliseconds (optional) |
padding |
number
|
Camera padding in pixel (optional) |
Param | Type | Details |
---|---|---|
center |
ILatLng
|
Center position of circle |
radius |
number
|
Radius of circle in meter |
strokeColor |
string
|
Set the stroke color (rgb, rgba, #RRGGBB, "colorname", ...etc) (optional) |
strokeWidth |
number
|
Set the stroke width in pixel (optional) |
fillColor |
string
|
Set the inside color of polygon (rgb, rgba, #RRGGBB, "colorname", ...etc) (optional) |
clickable |
boolean
|
Set to true to receive the CIRCLE_CLICK event (default: false) (optional) |
visible |
boolean
|
Set to false to hide (optional) |
zIndex |
number
|
Z-index (optional) |
GeocoderRequest
Param | Type | Details |
---|---|---|
address |
string | string[]
|
The address property or position property is required. You can not specify both property at the same time. [geocoding usage1] let request: GeocoderRequest = { address: "Los Angeles, California, USA" }; [geocoding usage2] let request: GeocoderRequest = { address: [ "Los Angeles, California, USA", "San Francisco, California, USA", ] }; (optional) |
position |
ILatLng | ILatLng[]
|
[reverse-geocoding usage1] let request: GeocoderRequest = { position: {"lat": 37.421655, "lng": -122.085637} }; [reverse-geocoding usage2] let request: GeocoderRequest = { address: [ {"lat": 37.421655, "lng": -122.085637}, {"lat": 37.332, "lng": -122.030781} ] }; (optional) |
GeocoderResult
Param | Type | Details |
---|---|---|
adminArea |
string
|
(optional) |
country |
string
|
(optional) |
countryCode |
string
|
(optional) |
extra |
{
featureName?: string;
lines?: Array<string>;
permises?: string;
phone?: string;
url?: string
}
|
(optional) |
locale |
string
|
(optional) |
locality |
string
|
(optional) |
position |
ILatLng
|
(optional) |
postalCode |
string
|
(optional) |
subAdminArea |
string
|
(optional) |
subLocality |
string
|
(optional) |
subThoroughfare |
string
|
(optional) |
thoroughfare |
string
|
(optional) |
GroundOverlayOptions
Param | Type | Details |
---|---|---|
url |
string
|
URL of overlay |
bounds |
Array<ILatLng>
|
Bounds, array of ILatLng |
clickable |
boolean
|
Set to true to receive the GROUND_OVERLAY_CLICK event (default: false) (optional) |
visible |
boolean
|
Set to false to hide (optional) |
opacity |
number
|
Opacity. From 0.0 to 1.0 . (optional) |
bearing |
number
|
Bearing (optional) |
zIndex |
number
|
Z-index (optional) |
ILatLng
Param | Type | Details |
---|---|---|
lat |
number
|
|
lng |
number
|
MarkerIcon
Param | Type | Details |
---|---|---|
url |
string
|
(optional) |
size |
{
width?: number;
height?: number;
}
|
(optional) |
MarkerOptions
Param | Type | Details |
---|---|---|
icon |
any
|
The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64 (optional) |
title |
string
|
The content of the infoWindow. (optional) |
snippet |
string
|
The snippet of the infoWindow. (optional) |
position |
ILatLng
|
The position of the marker. (optional) |
infoWindowAnchor |
number[]
|
Specify the anchor of the InfoWindow (optional) |
draggable |
boolean
|
Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker. (optional) |
flat |
boolean
|
Set true if you want to use a flat marker. (Default: false) (optional) |
rotation |
number
|
Set rotation angle. (Default: 0) (optional) |
visible |
boolean
|
Set false if you want to hide. (Default: true) (optional) |
styles |
any
|
Specify the options for title. This property work for normal InfoWindow. (optional) |
animation |
string
|
Which animation to play when marker is added to a map. (optional) |
zIndex |
number
|
Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (optional) |
disableAutoPan |
boolean
|
Set to true to disable auto panning when the marker is clicked. (optional) |
MarkerClusterIcon
MarkerClusterOptions
Param | Type | Details |
---|---|---|
maxZoomLevel |
number
|
Maximum zoom level of clustering (default: 15, max: 18) (optional) |
boundsDraw |
boolean
|
Draw a rectangle that contains all locations of clustered when you tap on a clister marker. (default: true) (optional) |
markers |
MarkerOptions[]
|
Position list [ {title: "store A", position: {lat: ..., lng: ...}}, {title: "store B", position: {lat: ..., lng: ...}}, {title: "store C", position: {lat: ..., lng: ...}} ] |
icons |
any[]
|
Conditions of clustering [ {icon: "assets/small.png", min: 2, max: 10}, {icon: "assets/middle.png", min: 11, max: 30}, {icon: "assets/large.png", min: 31}, ] |
MyLocation
Param | Type | Details |
---|---|---|
latLng |
LatLng
|
(optional) |
elapsedRealtimeNanos |
any
|
(optional) |
time |
string
|
(optional) |
accuracy |
any
|
(optional) |
bearing |
number
|
(optional) |
altitude |
any
|
(optional) |
speed |
number
|
(optional) |
provider |
any
|
(optional) |
hashCode |
any
|
(optional) |
MyLocationOptions
Param | Type | Details |
---|---|---|
enableHighAccuracy |
boolean
|
Set true if you want to try to use GPS mandatory. (In false, the plugin try to use GPS and network) (default: false) (optional) |
PolygonOptions
Param | Type | Details |
---|---|---|
points |
Array<ILatLng>
|
Pass ILatLng[] to specify the vertixes. You need to contain two points at least. |
geodesic |
boolean
|
Set true if you want to draw the curve polygon based on the earth (default: false) (optional) |
strokeColor |
string
|
Set the stroke color (rgb, rgba, #RRGGBB, "colorname", ...etc) (optional) |
strokeWidth |
number
|
Set the stroke width in pixel (optional) |
fillColor |
string
|
Set the inside color of polygon (rgb, rgba, #RRGGBB, "colorname", ...etc) (optional) |
visible |
boolean
|
Set false if you want to create invisible polygon (Invisible polygon is not clickable, default true) (optional) |
zIndex |
number
|
Hierarchy z-index (optional) |
addHole |
Array<Array<ILatLng>>
|
Pass ILatLng[][] to create holes in polygon (optional) |
clickable |
boolean
|
Set true if you want to receive the POLYGON_CLICK event (default: false) (optional) |
PolylineOptions
Param | Type | Details |
---|---|---|
points |
Array<ILatLng>
|
Pass ILatLng[] to specify the vertixes. You need to contain two points at least. |
visible |
boolean
|
Set false if you want to create invisible polyline (Invisible polyline is not clickable, default true) (optional) |
geodesic |
boolean
|
Set true if you want to draw the curve polyline based on the earth (default: false) (optional) |
color |
string
|
Set the stroke color (rgb, rgba, #RRGGBB, "colorname", ...etc) (optional) |
width |
number
|
Set the stroke width in pixel (optional) |
zIndex |
number
|
Hierarchy z-index (optional) |
clickable |
boolean
|
Set true if you want to receive the POLYLINE_CLICK event (default: false) (optional) |
TileOverlayOptions
Param | Type | Details |
---|---|---|
getTile |
(x: number, y: number, zoom: number) => string
|
This callback must return string of image URL. If no tile, you need to return null. |
visible |
boolean
|
Set false if you want to create invisible tilelayer (default true) (optional) |
zIndex |
number
|
Hierarchy z-index of tilelayer (optional) |
tileSize |
number
|
Default: 512px (optional) |
opacity |
number
|
Default: 1.0 (optional) |
debug |
boolean
|
Set true if you want to display the tile information over the tile images. (optional) |
KmlOverlayOptions
Param | Type | Details |
---|---|---|
url |
string
|
|
clickable |
boolean
|
(optional) |
suppressInfoWindows |
boolean
|
(optional) |
VisibleRegion
Param | Type | Details |
---|---|---|
northeast |
ILatLng
|
The northeast of the bounds that contains the farLeft, farRight, nearLeft and nearRight. Since the map view is able to rotate, the farRight is not the same as the northeast. |
southwest |
ILatLng
|
The southwest of the bounds that contains the farLeft, farRight, nearLeft and nearRight. Since the map view is able to rotate, the nearLeft is not the same as the southwest. |
farLeft |
ILatLng
|
The nearRight indicates the lat/lng of the top-left of the map view. |
farRight |
ILatLng
|
The nearRight indicates the lat/lng of the top-right of the map view. |
nearLeft |
ILatLng
|
The nearRight indicates the lat/lng of the bottom-left of the map view. |
nearRight |
ILatLng
|
The nearRight indicates the lat/lng of the bottom-right of the map view. |
type |
string
|
constant value : |
toString |
string
|
Converts to string |
toUrlValue |
string
|
Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box. |
contains |
boolean
|
Returns true if the given lat/lng is in this bounds. |