question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getmap is not defined in GoogleMaps plugin

See original GitHub issue

I’ve tried to add the Google Maps plugin to my app, but when I use the camera option the map canvas is completely white and there’s an error: ‘getMap’ is not defined in GoogleMaps plugin.

This is the code I used:

var div = document.getElementById("map");
var map;       

// Initialize the map view
map = plugin.google.maps.Map.getMap(div, {
    'controls': {
        'myLocationButton': true,
        'zoom': true
    },
    'gestures': {
        'scroll': true,
        'tilt': true,
        'rotate': true,
        'zoom': true
    },
    'camera': {
        'zoom': 15
    }
});

If I remove the camera option the map canvas becomes grey with the Google logo in the left corner and the zoom buttons etc. at the right side of the screen.

This is the code I used without the camera option:

var div = document.getElementById("map");
var map;       

// Initialize the map view
map = plugin.google.maps.Map.getMap(div, {
    'controls': {
        'myLocationButton': true,
        'zoom': true
    },
    'gestures': {
        'scroll': true,
        'tilt': true,
        'rotate': true,
        'zoom': true
    }
});

This problem is also referenced in #434.

Is this a bug or am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alfabetagamacommented, Mar 15, 2017

Removing camera section from map options solved this for me. Is there a bug still lurking?

0reactions
caden311commented, May 31, 2017

@alfabetagama Thank you!!! This was the only thing stopped me from being android ready. Removing the camera section from

this.googleMaps.create(element, {
      'backgroundColor': 'white',
      'controls': {
        'compass': false
      },
      'camera':{
       },
      'gestures': {
      },
      'styles': [
        {
          "stylers": [
            {
              "saturation": -5
            },
            {
              "lightness": 25
            }
          ]
        },
        {
          "featureType": "landscape",
          "elementType": "geometry.fill",
          "stylers": [
            {
              "lightness": 55
            }
          ]
        }
      ]
    });

Fixed it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

plugin is not defined (cordova-plugin-googlemaps)
I get error in $ var map = plugin.google.maps.Map.getMap(); produce "plugin is not defined" error. Thanks. cordova · google-maps-api-3 ...
Read more >
Overview | Maps JavaScript API - Google Developers
Get started with the Google Maps JavaScript API. View a simple example, learn the concepts, and create custom maps for your site.
Read more >
nightstomp/cordova-plugin-googlemaps - Gitter
getElementById("map_canvas"); var map = plugin.google.maps. ... I updated to 1.3.9 and am getting "'getMap' is not defined in GoogleMaps" in the console.
Read more >
Manipulating the map in JS - [GM] Unable to find map
At a glance, it sounds like it's just a matter of waiting for everything to finish loading. You are trying to call a...
Read more >
How to generate and set a Google Maps API key - Yoast
1. Copy the API key you created from the Google Maps Platform. 2. When you're logged in, you will be in your 'Dashboard'....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found