C
C#13mo ago
linqisnice

❔ Building a location search engine (airbnb/booking style)

What is more common here? To text match locations (i.e. search USA, grab anything in the DB in the US) or to store listing locations along with coordinates, and when a search is made, convert the adderss/country/city in the search bar into coordinates and matching those iwith the ones stored in the db? Or a mix? I feel like either way, we'd need the geolocation of the geographic entity to be able to include anything within the specified radius The best approach I've come up with is this: Use bounding box (SW/NE to create a rectangle) for anything over X size (like countries and counties and states etc) and for anything smaller, like cities or towns or addresses, use a radius filter from the centroid of the geographic entity. Or is there some better way ot do it?
3 Replies
Angius
Angius13mo ago
Depending on the database you use, you could just query the data by the geographical location So getting all locations within 50km from a selected city would be as easy as a normal WHERE
linqisnice
linqisnice13mo ago
@angiusreally? im using mssql or well I kind of knew that but the radius isn't the problem I think, I think the bigger problem is how can i determine what is an exact match and what isn't in order to know if I want to use 25km radius or 50km or 200km radius, I'd need to know the size of the geographic entity it makes no sense to use 25km radius for a state, since that state could be very large and 25km from the centroid would be nothing
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts