Open 12people opened 2 years ago
This is a design decision of course but I think it would be good for this project to let users set their location themselves. This is a feature that some dating sites give to users freely, while others sell it to them as a premium feature but I think it's in the interest of the users to make this the default.
edit: If users set their location themselves then you would show their city (and maybe the distance) in the profile while still keeping the distance filtering in the search.
I'm not against this idea, but how do you think it should be implemented?
@Nonononoki You can take a look at trustroots.org or bewelcome.org to see how they do it. They're both free software projects and their main method of choosing a location is using address autofill. I'm not sure what exact API they use, but it seems like the autofill uses the language that the person has set as the UI language. I've found this approach to work well personally, at least on those two platforms.
trustroots.org uses mapbox geocoding: https://github.com/Trustroots/trustroots/blob/efceb3cbb956531ac595d3d7bb668de383826014/modules/core/client/services/location.client.service.js
BeWelcome looks like it uses google geocoding: https://github.com/BeWelcome/rox/blob/f30e21cca19446c3228c8f7b56025a9b22dddf95/build/geo/geo.model.php#L111
You can download a list of cities with a population of more than 500, 1000, 5000, or 15000 inhabitants from geonames.org. This would favor a UI design where a user can enter a City with autocomplete instead of picking a place from a map.
Edit: Of course you could also have them pick from a map building on this data, building a reverse geolocation API ourselves.
If you want the user to pick a place from the map then OSM Nominatim would be an option: https://nominatim.openstreetmap.org/reverse?format=xml&lat=47&lon=32&zoom=18&addressdetails=1
But that would also have to be self-hosted: https://operations.osmfoundation.org/policies/nominatim/
Self hosting for Nominatim is done by importing OSM data into PostGIS through https://github.com/openstreetmap/osm2pgsql
Off-topic, but PostGIS is nice anyways since you can do something like this:
SELECT *
FROM tbl t1
WHERE ST_DWithin(t.geo_point, t1.geo_point, 50)
See http://postgis.net/docs/ST_DWithin.html
I think currently geo search uses a square instead of a circle, no? But I get if you don't want to change databases, @Nonononoki . :D
@fapdash The most elegant solution is to automatically set the city when the location is set. Self hosting Nominatim sounds like a good idea. But overall it's quite a lot of work for such a small feature. And yes, the search is a square right now, no complicated calculations needed :D
@Nonononoki A simple first step solution could be to change nothing, but let people write their city in the profile settings.
A free-text "city" profile item is absolutely good enough when you have distance-based search. No need to try and be too clever here, you'll never get selectable cities to reflect all the different ways people talk about their place. For example, the same person in the same location might list their location as any of the following, depending on their preference:
It'd be nice to know which city a person is in. While relative distances are nice, they're not particularly helpful for guessing whether you'd be able to visit a person easily through public transport or whether they're even in the same country.