How to reduce Google Distance Matrix API cost in a location-based application?
I am building a Node.js application where I need to calculate road distance between user location and multiple destinations (like nearby academies). Currently, I am using Google Distance Matrix API Current Flow: - User sends location (lat/lng) - I fetch nearby ~100–150 locations from MongoDB using "$geoNear" - Then I call Distance Matrix API to calculate road distance - I batch requests (25 destinations per request) Problem: My API cost is getting very high because: - Many users request similar locations - Same routes are calculated again and again - Distance Matrix charges per element (origin
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.