3

I'm trying to use the google places api on the same page as an openlayers map using olgm to serve and embedded google map.

I need to have a handle to the google map in order to construct the places api PlacesService:

var placesService = new google.maps.places.PlacesService(gmap);

However, olgm encapsulates the google map and I can't work out how to get a reference to it:

olgm.OLGoogleMaps = function(options) {
    ...
    var gmap = new google.maps.Map(gmapEl, {
    ...

Any ideas?

pstanton
  • 35,033
  • 24
  • 126
  • 168

1 Answers1

3

You can access the Google Maps object if you have access to the olgm object:

var olGM = new olgm.OLGoogleMaps({map: map});
var gmap = olGM.getGoogleMapsMap();

For the debug version, if you are using the latest release (0.6 as of today), you can download it here, in the downloads section: https://github.com/mapgears/ol3-google-maps/releases/tag/v0.6

In the .zip you will find a file named ol3gm-debug.js

If you're building your own version, it should appear in the dist directory.

Samuel Lapointe
  • 305
  • 3
  • 13