I am using node-googlemaps to query the Google Maps API
from Node js. I have created my Server API key as a Developer. According to the this documentation, I have to make a publicConfig
variable with my API key and certain other parameters. My publicConfig variable is as follows:
var gm = require('googlemaps');
var publicConfig = {
key: 'myKey',
stagger_time:1000, // for elevationPath
encode_polylines:false,
secure:true // use https
};
var gmAPI = new GoogleMapsAPI(publicConfig);
When I run the Code, I get the following error
ReferenceError: GoogleMapsAPI is not defined
Can somebody help me on this issue?
There are a several reasons why your google maps may not be working, the most common issue being no Google Map API key set or set incorrectly. To use the Google Maps JavaScript API, you must register your app project on the Google Cloud Platform Console and get a Google API key which you can add to your app.
If this error message appears while trying to access our map page, it means that Google is being blocked, either by the browser or the network.
API keys have multiple dependencies that can result in errors like: "The user is not authorized for this operation based on …". Please make sure you are using the correct credentials and endpoint with the correct API key.
To Resolve this issue I had include the following line of Code
var GoogleMapsAPI = require('googlemaps');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With