Skip to content
This repository has been archived by the owner. It is now read-only.

Add geolocalisation #3411

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 10 comments
Closed

Add geolocalisation #3411

openstreetmap-trac opened this issue Jul 23, 2021 · 10 comments

Comments

@openstreetmap-trac
Copy link

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Reporter: AlexanderMatheisen[at]ish.de
[Submitted to the original trac issue database at 7.57am, Wednesday, 22nd December 2010]

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

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 9.31am, Wednesday, 22nd December 2010]

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.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: rurseekatze
[Added to the original trac issue at 4.49pm, Wednesday, 22nd December 2010]

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 osm.org 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?

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 5.10pm, Wednesday, 22nd December 2010]

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.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 5.11pm, Wednesday, 22nd December 2010]

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.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: rurseekatze
[Added to the original trac issue at 5.27pm, Wednesday, 22nd December 2010]

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)
setPositionByIp();
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?

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: rurseekatze
[Added to the original trac issue at 5.29pm, Wednesday, 22nd December 2010]

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

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 5.38pm, Wednesday, 22nd December 2010]

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.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: gulp21
[Added to the original trac issue at 2.53pm, Saturday, 8th January 2011]

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 osm.org:

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

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: SomeoneElse
[Added to the original trac issue at 10.34pm, Saturday, 11th February 2012]

Another suggestion:

Currently osm.org 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?

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: gulp21
[Added to the original trac issue at 9.55pm, Saturday, 20th July 2013]

fixed with new design

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant