Opened 10 years ago

Closed 7 years ago

#3411 closed enhancement (fixed)

Add geolocalisation

Reported by: AlexanderMatheisen@… Owned by: rails-dev@…
Priority: trivial Milestone: Wishlist
Component: website Version:
Keywords: user_location Cc:


A geolocalisation would be very useful. Either automatically or with a button to click on. In browsers without geolocation API this colud be done with the IP or the user's language

Change History (12)

comment:1 Changed 10 years ago by Tom Hughes

Resolution: wontfix
Status: newclosed

We already do IP based geolocation when we don't have any better idea what part of the map to display.

I'm reluctant to add browser based geolocation because it's exceedingly annoying to the vast majority of our users that are using desktop browsers that have no idea of their location but will still pester the user if the site starts asking for it.

comment:2 Changed 10 years ago by rurseekatze

Resolution: wontfix
Status: closedreopened

I cannot follow you. I said "or a button to click on", so why should the user be pestered? The geolocation is one of the features I like much at other maps, but in it is still missing. If you make a button/link "My location" the user can jump to his position, but other users are not affected. What is the problem?

comment:3 Changed 10 years ago by Tom Hughes

Well the problem with a link is that we would need to find space for it and space on our homepage is very tight.

If we had space then there are other things which are higher priority (like a way to change the current language) which I would add first.

comment:4 Changed 10 years ago by Tom Hughes

Oh I would also add that given that the slippy map doesn't really work on mobile devices, which are where this feature would be really useful, such a link would be of limited benefit.

comment:5 Changed 10 years ago by rurseekatze

As I see yo do not want to add this feature...

There is enough space on the whole page, in the search box, on the top near the login link or on the map just under the permalink. This link needs just some characters, a short caption like "My position" is enough and fits everywhere on the site!

Adding this feature is not really much to do. Here is the source code, you just need to add these lines:

if geolocation is available if (navigator.geolocation && typeof navigator.geolocation.getCurrentPosition != 'undefined') {

call function to jump to geolocated position navigator.geolocation.getCurrentPosition(setGeolocatedPosition, geolocationError);


called when geolocation api caused an errors function geolocationError(error) {

if(error.code >= 0 && error.code <= 3)


return true;


set position by geolocation api function setGeolocatedPosition(position) {

set position of map to geolocated position var startPosition = new OpenLayers?.LonLat?(position.coords.longitude, position.coords.latitude).transform(wgs84, map.getProjectionObject()); map.setCenter(startPosition, 12);


Why do you oppose to add this feature? What is the problem?

comment:6 Changed 10 years ago by rurseekatze

Sorry, the source code is a bit disordered...

comment:7 Changed 10 years ago by Tom Hughes

It's not that I don't want to add it - if there was cost to doing so I would do so in a heartbeat.

Adding anything to the left hand sidebar is very difficult because it forces whatever is below it down the page which causes complaints from people when things then fall off the bottom of the page and force them to scroll their window.

Adding things to the top bar is also difficult - not everybody will have a window as wide as yours and many people will not have much space there, especially if they are logged in and have a long username. When whitespace runs out in the top bar the tabs start doing horrible things which is why I try and make sure there is plenty of space.

In short everything is a trade off between the cost (potentially suboptimal formatting of the front page for a number of people) and the benefit (allowing a possibly small number of people an easy way to go to what their browser thinks is their current location). Right now I think the balance lies against you but that will probably change at some point.

comment:8 in reply to:  7 Changed 10 years ago by gulp21

What about the way Google Maps is handling the problem: There's a small button above the zoom slider and when you click on it the geolocation API is used to align the map so that your current position is in the center. When you zoom in you see map of your current position.

I'd suggest something similar for

  • Add a small blue circle underneath the "-" button* which can be clicked in order to get the current position (either by geolocation API or by IP if the former is not available)
  • We zoom to z13 of the area

*) I think above "+" button would be better, but I don't know whether we can move the zoom slider without changing too much other code

I think such a small button wouldn't disturb anyone.

comment:9 Changed 9 years ago by Tom Hughes

Owner: changed from Tom Hughes to rails-dev@…

comment:10 Changed 9 years ago by stevens

Keywords: user_location added

comment:11 Changed 9 years ago by SomeoneElse

Another suggestion:

Currently does some things differently if the browser window is "small" - it doesn't display the sidebar at the left and replaces the zoom slider with a simple "up and down". Perhaps an automatic geolocation attempt would make sense in a "small" (presumably mobile) browser window?

comment:12 Changed 7 years ago by gulp21

Resolution: fixed
Status: reopenedclosed

fixed with new design

Note: See TracTickets for help on using tickets.