Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#1872 closed enhancement (fixed)

Tidy up coordinates on diary entries

Reported by: Dan Karran Owned by: Tom Hughes
Priority: minor Milestone:
Component: website Version:
Keywords: Cc:


The coordinates that show on diary entries are a little unwieldy, and I believe unnecessarily so. The attached patch tidies them up a little by limiting the display of them to 4 decimal places.

Attachments (2)

tidy_diary_coordinates.patch (1.7 KB) - added by Dan Karran 11 years ago.
tidy_diary_coordinates.2.patch (2.8 KB) - added by Dan Karran 11 years ago.

Download all attachments as: .zip

Change History (9)

Changed 11 years ago by Dan Karran

comment:1 Changed 11 years ago by Shaun McDonald

Personally I think that it would be better to store them to a more reasonable number of decimal places, rather than making the view code messier.

comment:2 Changed 11 years ago by Thomas Wood

I'd lean the other way from shaun and keep the stored numbers at the current precision, and change the patch to pass all digits in the links, rather than cropping them to 4dp. (But keep the displayed digits at 4dp)

Changed 11 years ago by Dan Karran

comment:3 Changed 11 years ago by Dan Karran

I'm sort of somewhere in between. When people are using the map to set the coordinates, I doubt we need to give them all those dp, so maybe limit the default. Perhaps limit that through js, but let them enter a more precise figure if they really want to? Then we display a fixed amount, but link them through to what was entered originally. Bit of a compromise?

Updated patch attached.

comment:4 Changed 11 years ago by Thomas Wood

I was going to add that it should be possible to reuse the code we use for creating permalinks of a number of decimal places appropriate to the zoom level viewed. Since diary entries don't indicate the zoom they should be viewed at, it would give an idea at what level of detail the coords refer to.

comment:5 Changed 11 years ago by Thomas Wood

The code I was thinking of was

var decimals = Math.pow(10, Math.floor(zoom/3));
lat = Math.round(lat * decimals) / decimals;
lon = Math.round(lon * decimals) / decimals;

Which is currently embedded into the top of the updatelinks function of site.js.

comment:6 Changed 10 years ago by Tom Hughes

Resolution: fixed
Status: newclosed

As of r20184 we now display a reverse geocoded description of the location rather than the raw coordinates.

comment:7 Changed 10 years ago by dankarran

Much better than my original proposal, thanks Tom.

Note: See TracTickets for help on using tickets.