Skip to content

Map.setOptions()

Masashi Katsumata edited this page Sep 20, 2016 · 9 revisions

Creates a map with initialize options. You can initialize the camera view when the map is initialized. This is useful when you want to show the specific location of the map.

Also you can change the camera view and the UIs. This is useful when you want to show the specific location of the map. Available options are mapType, controls, gestures, camera, and backgroundColor.

const GORYOKAKU_JAPAN = new plugin.google.maps.LatLng(41.796875,140.757007);

map.setOptions({
  'backgroundColor': 'white',
  'mapType': plugin.google.maps.MapTypeId.HYBRID,
  'controls': {
    'compass': true,
    'myLocationButton': true,
    'indoorPicker': true,
    'zoom': true // Only for Android
  },
  'gestures': {
    'scroll': true,
    'tilt': true,
    'rotate': true,
    'zoom': true
  },
  'camera': {
    'latLng': GORYOKAKU_JAPAN,
    'tilt': 30,
    'zoom': 15,
    'bearing': 50
  }
});


###Code

const GOOGLE = new plugin.google.maps.LatLng(37.422848, -122.085565);
map.moveCamera({
  'target': GOOGLE,
  'tilt': 60,
  'zoom': 18,
  'bearing': 140
});
$(":checkbox").off();
$(":checkbox").on("change", function() {
  var optName = $(this).attr("id").replace("chk_", "");
  var options = {
    controls: {}
  };
  options.controls[optName] = $(this).is(":checked");
  map.setOptions(options);
});

Join the official community

New versions will be announced through the official community. Stay tune!

Do you have a question or feature request?

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

Clone this wiki locally