r/webdev • u/BikemeAway • 11h ago
Is there a good alternative to Google Search API?
I'm building an app with a map with my own data on it, however I need to search for locations, like trains stations or stores and get their position.
I tried Photon/Nomination from OpenStreetMaps and it's ridiculously bad for basic things. It cannot find simple things like stations and it messes up with different languages.
Mapbox API is a little bit better but still unreliable.
Apparently Google cannot be beaten?
0
Upvotes
1
u/Open_Appointment9671 11h ago
Photon and Nominatim are both OSM, so that's one failed test, not two. And "find the train station" is POI search, you're judging geocoders for not doing a job they don't do. Could've saved yourself the whole comparison.
1
u/Aggressive_Sound2536 11h ago
Just use Google then, honestly.
2
u/Warm-Republic-1913 11h ago
The OpenStreetMap geocoder is built mainly for addresses and place names, so it handles stations and shops poorly when you throw a free-text query at it. For points of interest it is usually better to query the underlying OSM data by tag, for example railway=station or shop=supermarket, inside a bounding box around the map view, and then match on the name tags. OSM also stores names per language as name:fr, name:de and so on, so searching those tags fixes most of the multi-language misses. Coverage depends on how well your region is mapped, so if a place really is missing from OSM, no query will find it, and that is where paid datasets are ahead.
2
u/razzzey 8h ago
If you know the kind of data you need, just pull it from OSM (directly from a PBF or from overpass) and build your own search around it.
There's also this new rust-based geocoder that might be better (they claim, I haven't tried it yet). https://github.com/open-geocode-rs/open-geocode
1
u/Afnan_CH_Digital 9h ago
For stations and stores specifically, OpenStreetMap data is usually excellent - the weak point is more the geocoder ranking than the data. A few things that helped me:
Nominatim results improve a lot when you pass countrycodes, a bounded viewbox around the map's current viewport, and accept-language matching the user's locale. Without those it guesses globally and the multilingual mess you describe appears.
For categories like train stations, skip geocoding and query Overpass API directly - railway=station is consistently tagged and you get exact coordinates back.
Pelias (the geocode.earth stack, self-hostable) also ranks OSM plus Who's on First data noticeably better than bare Nominatim for this kind of search.
On the last question: for fuzzy "find a business by name" queries, Google's Places data is genuinely ahead, mostly from user-contributed listings. But for well-defined categories like stations, OSM via Overpass beats it - free and no quota.