GroundOverlay class

September 29, 2018 ยท View on GitHub

This class extends BaseClass.

Contents


Overview

Create one GroundOverlay

map: GoogleMap;

loadMap() {

  let bounds: ILatLng[] = [
    {"lat": 40.712216, "lng": -74.22655},
    {"lat": 40.773941, "lng": -74.12544}
  ];

  this.map = GoogleMaps.create('map_canvas', {
    camera: {
      target: bounds
    }
  });

  // Add ground overlay
  let groundOverlay: GroundOverlay = this.map.addGroundOverlay({
    'url': "../images/newark_nj_1922.jpg",
    'bounds': bounds,
    'opacity': 0.5
  });
}

Listen CLICK event

In order to listen the GROUND_OVERLAY_CLICK event, you need to specify the clickable option. You can get the latitude/longitude pair of clicked position.

let bounds: ILatLng[] = [
  {"lat": 40.712216, "lng": -74.22655},
  {"lat": 40.773941, "lng": -74.12544}
];

// Add ground overlay
let groundOverlay: GroundOverlay = this.map.addGroundOverlay({
  'url': "../images/newark_nj_1922.jpg",
  'bounds': bounds,
  'opacity': 0.5,
  'clickable': true  // default = false
});

// Catch the GROUND_OVERLAY_CLICK event
groundOverlay.on(GoogleMapsEvent.GROUND_OVERLAY_CLICK).subscribe((params: any[]) => {
  let latLng: ILatLng = params[0];
  ...
});

API Reference


Create methods


Instance methods


Event

  • GROUND_OVERLAY_CLICK :orange_book:

    This event is fired when you click on a ground overlay.

    Params Type Details
    params[0] LatLng clicked position
    params[1] GroundOverlay ground overlay instance