-
Notifications
You must be signed in to change notification settings - Fork 918
Map.getMap()
The Map.getMap()
is a static method. You can grab a map instance.
###Description
The Map.getMap()
method returns an instance of the map class.
The plugin initializes the native SDK and other thing, it takes a few second.
The MAP_READY
event is fired when the map is ready to go.
This plugin generates only one map instance using Map.getMap()
method.
In general, you may want to create multiple maps, but this plugin is not possible.
###Code
var map = plugin.google.maps.Map.getMap();
map.addEventListener(plugin.google.maps.event.MAP_READY, function onMapInit(map) {
// The map is initialized, then show a map dialog
map.showDialog();
});
You can intialize the map status with options. This is useful when you want to show the specific location of the map.
const GORYOKAKU_JAPAN = new plugin.google.maps.LatLng(41.796875,140.757007);
var map = plugin.google.maps.Map.getMap({
'backgroundColor': 'white',
'mapType': plugin.google.maps.MapTypeId.HYBRID,
'controls': {
'compass': true,
'myLocationButton': true,
'indoorPicker': true,
'zoom': true
},
'gestures': {
'scroll': true,
'tilt': true,
'rotate': true
},
'camera': {
'latLng': GORYOKAKU_JAPAN,
'tilt': 30,
'zoom': 15,
'bearing': 50
}
});
If you get an error, feel free to ask me on the official community or the issue list.
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md
New versions will be announced through the official community. Stay tune!
Feel free to ask me on the issues tracker.
Or on the official community is also welcome!
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md