Closed magnificode closed 3 years ago
Might be worth having a discussion with mapbox to see if they have a discounted/free plan for OSS Community projects - https://www.mapbox.com/community/
Closing this out as it doesn't seem to be a trackable issue at the moment.
The Context
As it stands, we are using the Google Places API to take in a location string (e.g "Atlanta, GA", "ATL", "Georgia" etc.) and convert it to latitude and longitude coordinates in order to return businesses that match the queried location.
https://github.com/Rebuild-Black-Business/RBB-Website/blob/main/src/api/geocode.js#L3
Our
handleLocationToCoords
function here ingests the queried string, and hands it off to the Google Places API which will return the closest matching lat/long values. This lat/long combo is used to search the RBB API and return results within a radius of that point.https://github.com/Rebuild-Black-Business/RBB-Website/blob/main/src/templates/businesses.js#L78
On the businesses template, we leverage our
handleLocationToCoords
function by passing it the query string params that are appended to the search URL.The Problem
The problem that we're facing is the potential redundancy in API calls to Google, which could end up getting costly down the line.
The Desired Solution
Make sure that the Google Place API is not being called in places where it's not being used (Home page, Allies, etc.)