mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
718 stars 186 forks source link

Unclear how to instantiate geocodingClient object #402

Open alexandermorgan opened 4 years ago

alexandermorgan commented 4 years ago

Docs issue: The documentation examples for the geocoding service look great but it's unclear how to import/instantiate the geocodingClient object that all of the examples use. For example, with the reverse geocoding example:

geocodingClient.reverseGeocode({
  query: [-95.4431142, 33.6875431]
}) ...

... where do you get the geocodingClient object?

andrewharvey commented 4 years ago

We could probably improve this but it touches on this at https://github.com/mapbox/mapbox-sdk-js#creating-clients it also comes down to your style preference how you want to name the variables but for example:

const MapboxGeocoder = require('@mapbox/mapbox-sdk/services/geocoding');
const geocoder = MapboxGeocoder({ accessToken: MY_ACCESS_TOKEN });

then geocoder.reserveGeocode

buildgreatthings commented 2 years ago

@andrewharvey Friendly suggestion to move this to the actual doc pages. This added an extra 5 min for me too.