alovoa icon indicating copy to clipboard operation
alovoa copied to clipboard

Show city in profile

Open 12people opened this issue 2 years ago • 7 comments

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.

12people avatar Mar 21 '22 07:03 12people

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.

fapdash avatar Mar 22 '22 12:03 fapdash

I'm not against this idea, but how do you think it should be implemented?

  1. Set the city by longitude/latitude. Which API to use?
  2. Let the user set a city name manually. Free input or choose from selection? If free input, can't the user just write it in their description? If selection, what language should the city name be? If multilanguage, where do the translated names come from?

Nonononoki avatar Apr 09 '22 08:04 Nonononoki

@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.

12people avatar Apr 09 '22 09:04 12people

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


Picking City via Input Field

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.

  • http://download.geonames.org/export/dump/readme.txt
  • http://download.geonames.org/export/dump/
  • http://download.geonames.org/export/dump/cities1000.zip

Edit: Of course you could also have them pick from a map building on this data, building a reverse geolocation API ourselves.

Picking City through Map

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 avatar Apr 09 '22 12:04 fapdash

@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 avatar Apr 09 '22 13:04 Nonononoki

@Nonononoki A simple first step solution could be to change nothing, but let people write their city in the profile settings.

Leaced avatar Dec 06 '22 14:12 Leaced