Hi, I've been enjoying getting the geolocator integrated into my node project. I'm getting an unusual error, when attempting to run try the example in the "Guide" section:
The "map-canvas" div is in a pug script, and this is the Javascript that's called by the GET request:
const geolocator = require('geolocator');
exports.getTestMap = (req, res) => {
geolocator.config({
language: "en",
google: {
version: process.env.GOOGLE_MAPS_VERSION,
key: process.env.GOOGLE_MAPS_KEY
}
});
var options = {
enableHighAccuracy: false,
timeout: 5000,
maximumWait: 1500, // max wait time for desired accuracy
maximumAge: 0, // disable cache
desiredAccuracy: 100, // meters
fallbackToIP: true, // fallback to IP if Geolocation fails or rejected
addressLookup: false, // requires Google API key if true
timezone: false, // requires Google API key if true
map: "map-canvas", // interactive map element id (or options object)
staticMap: true // map image URL (boolean or options object) // false => moveable marker?
};
// If you've enabled map option include the following inside the <body> of your HTML:
// <div id="map-canvas" style="width:600px;height:400px"></div>
geolocator.locate(options, function (err, location) {
if (err) return console.log(err);
console.log(location);
});
res.render('api/testmap', {
title: 'testmap'
});
};
I apologize if this is not an issue in the code itself, but I am stuck. . Is this enough information to tell if there's an issue? Thanks so much for any help!