Closed andrecuellar closed 2 years ago
Hi, I am trying to pass my API key from Google Geocoder
let googleGeoCoderProvider = L.Control.Geocoder.google('MYGOOGLEAPIKEY'); L.Control.geocoder({ geocoder: googleGeoCoderProvider, }).addTo(map);
but the results in the console are https://maps.googleapis.com/maps/api/geocode/json?key=undefined&address=trompillo
is processing API key as undefined, the same problem with L.Control.Geocoder.Google('MYGOOGLEAPIKEY');
L.Control.Geocoder.Google('MYGOOGLEAPIKEY');
for it to work, I had to open the plugin code and directly replace key: with my APIKEY
key:
var Google = /*#__PURE__*/function () { function Google(options) { this.options = { serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json' }; L__namespace.Util.setOptions(this, options); } var _proto = Google.prototype; _proto.geocode = function geocode(query, cb, context) { var params = geocodingParams(this.options, { key: 'MYAPIKEY', address: query });
how can I pass the API key from my JS code?
Please see https://www.liedman.net/leaflet-control-geocoder/docs/classes/google.html#constructor
Hi, I am trying to pass my API key from Google Geocoder
but the results in the console are https://maps.googleapis.com/maps/api/geocode/json?key=undefined&address=trompillo
is processing API key as undefined, the same problem with
L.Control.Geocoder.Google('MYGOOGLEAPIKEY');
for it to work, I had to open the plugin code and directly replace
key:
with my APIKEYhow can I pass the API key from my JS code?