mwoffliner icon indicating copy to clipboard operation
mwoffliner copied to clipboard

Map location markers are wildly inaccurate in (at least) Wikivoyage

Open Jaifroid opened this issue 2 years ago • 11 comments

Please compare the red dot marking the location of Cambridge in the three renderings below. On the left is online German Wikivoyage (correct). In the middle is the rendering of the map in Kiwix Desktop. On the right is the rendering of the map in Kiwix JS. The fact that the two Kiwix renderings are so wrong (Cambridge appears to be located in south London!) suggests an issue in the ZIM, not in the readers.

image

Source: wikivoyage_de_all_maxi_2021-09.zim

Jaifroid avatar Sep 24 '21 06:09 Jaifroid

I think I've traced this error to the inclusion of an image caption beneath the image (in image above, you can see that the image caption is not present in the original online version). Examining this in dev tools, we can see the problem:

image

The table within which the marker is absolutely positioned is increased in height from 165x200 to 167x244.1. The extra 44 pixels is the displacement. If I delete the caption div from the DOM in Kiwix JS, the dot is then repositioned normally:

image

Jaifroid avatar Sep 24 '21 06:09 Jaifroid

@Jaifroid Thx for tbe bug report and analysis. I will try to confirm and fix.

kelson42 avatar Sep 24 '21 07:09 kelson42

Looks indeed bad on Wikivoyage: image

But interstingly, looks good on Wikipedia: image

kelson42 avatar Sep 26 '21 12:09 kelson42

The problem is quite complexe. The css which makes the caption invisible (and that way secure the geo localisation point is properly placed) relies on the figure node attribute typeof="mw:Image". There is actually many reasons at the MWoffliner level which this does not works fine but there is a more problematic reason upstream. In the mobile rest API, the typeof attribute is not present at all, look at https://de.wikivoyage.org/api/rest_v1/page/mobile-sections-lead/Cambridge. What is worse is that in the desktop rest API, it is here; look at https://de.wikivoyage.org/api/rest_v1/page/html/Cambridge. So it seems that the MCS just breaks things, but because nobody uses it so far I know (except us) nobody seems to care.

kelson42 avatar Sep 26 '21 13:09 kelson42

I have open an upstream ticket at https://phabricator.wikimedia.org/T291779.

kelson42 avatar Sep 26 '21 14:09 kelson42

Upstream bug ticket was a duplicate of https://phabricator.wikimedia.org/T271157 and it seems a fix has been merged (deployed?). I will monitor this and once the REST API is OK, will secure the MWoffliner part of the bug will be fixed.

kelson42 avatar Oct 01 '21 06:10 kelson42

Good news! Thanks.

Jaifroid avatar Oct 01 '21 10:10 Jaifroid

So far the patch is not applied.

kelson42 avatar Oct 02 '21 13:10 kelson42

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Mar 02 '22 08:03 stale[bot]

Related https://phabricator.wikimedia.org/T63566 moving forward upstream. I should have a look again to this ticket.

kelson42 avatar Jun 14 '22 04:06 kelson42

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar May 26 '23 18:05 stale[bot]