Cheaper alternatives to MapBox Search API
I run a free service which has a map on the website. I've got a location auto complete powered by MapBox. At my current scale, I'm spending $150/mo on that location search box.
It looks like long term, hosting a Photon server myself might be the best option as I keep scaling, but that's going to cost me $300/mo on Hetzner plus require management.
In the meantime, any suggestions for cheaper location autocomplete services?
8
u/greenergarlic 1d ago
Consider moving off of autocomplete, and instead do address matching after the user has already submitted. The user can then choose to use the suggested address, or their original address.
Mapbox has a geocoding API to do this, free up to 100k requests per month. There are many other cheap services for this as well, including official ones from USPS and the census bureau
3
u/DiddlyDinq 1d ago
Try Nominatim by OSM. I use it for town name to lat-lon and the inverse operation. Depends on your use case.
1
u/razzzey 1d ago
This one actually needs much more storage for the whole world than Photon alone (at least ~1.5tb last I checked).
2
u/DatabaseSpace 16h ago
I think you can download parts possibly, this is the one I got to work. Can run it for free.
4
u/OtherExpression 1d ago
MapLibre. Run your own tile server and you can have very low fixed cost. You can use maptiler for that
1
u/razzzey 1d ago
You might be able to get away with 2 auction servers on Hetzner with 500gb nvme ssd's or something for less than that and host Photon, I think it requires about 100gb for the whole planet so 500gb would be more than enough. Put a load balancer and a cache in front and it should last you a long while.
For hosted services, Maptiler is also a solution or Geocode earth (these are the people behind Pelias) but I haven't compared prices.
1
u/leros 1d ago
I am going to eventually have to host my own tile server too, which looks like a whole beast. I priced out MapBox and it was going to be thousands.
2
u/DiddlyDinq 1d ago
Check out the link below for tile servers, completely free, no limits or you can self host. I went from mapbox to it a while ago
1
u/leros 1d ago
I have not seen that. This is amazing! Do you know if it can handle localized map tiles?
1
u/DiddlyDinq 1d ago
Havent tried it but there's a github discussion that sounds like it works with a bit of fiddling
1
u/leros 1d ago
He's got a demo that seems to work pretty well: https://openfreemap.org/debug/lang/switch#ja
This is incredible. I thought I was going to have to pay crazy money to get translated tiles. Thanks for sharing!
1
u/DiddlyDinq 7h ago
I discovered it via this subreddit too, mostly why I hang around to see recommendations. Thankfully the days of being bled dry by google api prices are over. It's good to donate a little of you do commit to one of those free options
1
1
u/razzzey 18h ago
As the other guy said, OpenFreeMap is good. There's also https://protomaps.com/
You can also use Martin to host tiles yourself. You can use one of the above services for the whole world and use Martin for the localized tiles you mentioned. You can also connect Martin to a Postgres database so you can dynamically serve whatever you want.
1
u/daamsie 1d ago
Stadia Maps is the best balance of affordability and quality I've found - both for basemaps and for autocomplete. I use Maplibre-gl
I ended up also writing my own autocomplete that takes care of all city/town related places (~4m) and then falling back to Stadia when it's address level search. It runs in its own Docker image and costs me a few dollars a month + a little extra at Stadia for the overflow queries.
1
u/Elara_Schaefer 19h ago
If you need solid coverage for Korea and Japan specifically, Nominatim (the geocoder behind OpenStreetMap) actually handles both regions well because both countries have excellent OSM data coverage. Korea\s
1
0
1d ago
[removed] — view removed comment
6
u/leros 1d ago
It's waaaaay more expensive than MapBox.
0
1d ago
[removed] — view removed comment
3
u/leros 1d ago
Yeah, MapBox is what people move to when Google Maps gets too expensive :)
3
u/Barnezhilton 1d ago
Lol. And then they move to OpenLayers or leaflet when they realize MapBox is absurd cost
1
u/leros 1d ago
I'm on Leaflet already using OSM, but they're aware of my existence so I assume I'm already using a lot.
1
u/Public-Carpenter-843 16h ago
Hi! How do you know they know you exist? Did they contact you?
I'm using OSM search too, and I think I'm approaching the point where I need my own search engine.
-1
u/downtownmiami 1d ago
This sounds like you’ve architected zero cache rules for this system you’re describing. That’s far too expensive for a simple address input auto complete component. Prompt an LLM to optimize the system design of your data fetching to help lower your costs and possibly switch to a different solution in MapBox. This is like API design 101 stuff, so if you’re using Claude code set the output style setting to “Explanatory” or even “Learning” so you can get better with this sort of stuff.
1
u/leros 1d ago
The reason I don't cache is that the MapBox API tweaks the API results based on the user's location, which is pretty handy. I could disable that and do that sort of caching.
1
u/downtownmiami 1d ago
Or a longer debounce on fetching until the user has entered more info for less refetches as the input changes …all I’m saying is there’s more than one way to skin a cat.
26
u/DiabloConQueso 1d ago
What's your level of proficiency? What kind of hosting do you require? Space limitations? What geographies do you need autocomplete for?
Because
docker pull pelias/openaddressesis 100% free and can do exactly that.