Closed TannerJuby1 closed 2 years ago
Hi, thank you for logging the issue. I think you can pass the apikey with .geocode()
- here is sample code:
import * as esriLeafletGeocoder from "esri-leaflet-geocoder";
esriLeafletGeocoder
.geocode({
apikey: "...."
})
.text("380 New York St, Redlands, CA")
.run(function (err, results, response) {
if (err) {
console.log(err);
return;
}
console.log("geocode results:", results);
});
Here is a sample showing it working: https://codepen.io/gavinr/pen/mdpXXJd?editors=0010
For .reverseGeocode()
trying to follow the same pattern, I'm getting an error. I think it's an issue that needs correction in https://github.com/Esri/esri-leaflet-geocoder/blob/master/src/Tasks/ReverseGeocode.js (similar to the change in #278)
This is fixed in version 3.1.3.
I am trying to use this package with my Gatsby (react) project but am running into issues with using my apikey.
Due to an issue I recently opened I import this package directly into my components to try and use
When I use
geosearch
, the api key is applied and it works as expected:But the
geocode
andreverseGeocode
functions do not accept the apikey I pass in and I just get an error response about token being required. I've tried the following methods to pass in the apikey:and none of these work, I always get the
Token Required
error response.What is the proper way to pass the token to these methods?