Page MenuHomePhabricator

[Regression wmf.15] "<mapframe>: Attribute "latitude" has an invalid value" appearing while adding map
Closed, ResolvedPublic

Description

After adding a map with VE when I save the page, I see this error on the page in readmode instead of the map

<mapframe>: Attribute "latitude" has an invalid value

Event Timeline

Ryasmeen created this task.Aug 17 2016, 1:03 AM
Restricted Application added a project: Discovery. · View Herald TranscriptAug 17 2016, 1:03 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Yurik added subscribers: MaxSem, JGirault.
MaxSem triaged this task as High priority.Aug 17 2016, 4:58 AM

Reproduceable by inserting a map and saving without touching it, turns out it adds scientific notation:
<mapframe latitude="-1.1449996853268662e-13" longitude="0" zoom="0" width="400" height="300">
There is no reason to allow it in wikitext - it's confusing for non-technical people and not needed for ranges or precision in the context of web cartography. Let's round it to, say, 6 digits?

I think rounding should depend in the zoom level. At zoom 0, it should produce no decimals, and at zoom 18 -something like 7.

Yurik added a comment.Aug 17 2016, 5:34 PM

I spoke with @JGirault this morning - apparently we already have that code in Kartographer to optimize the URL anchor portion. We should simply reuse that.

The code that we have in Kartographer rounds like this:

Zoom levelDecimal precisionExample with lat=37.77493
0038
1038
2137.8
3237.77
4237.77
5337.775
6337.775
7337.775
8337.775
9337.7749
10437.7749
11437.7749
12437.7749
13437.7749
14437.7749
15437.7749
16437.7749
17537.77493
18537.77493

Change 306064 had a related patch set uploaded (by JGirault):
Round coordinates based on zoom level

https://gerrit.wikimedia.org/r/306064

Change 306064 merged by jenkins-bot:
Round coordinates based on zoom level

https://gerrit.wikimedia.org/r/306064

JGirault closed this task as Resolved.Aug 23 2016, 2:08 PM
JGirault claimed this task.