Page MenuHomePhabricator

rendering of <mapframe> (karthographer) is corrupt when width="100%"
Closed, ResolvedPublicBUG REPORT

Description

see https://de.wikipedia.org/wiki/Benutzer:Herzi_Pinki/maptest

the first mapframe uses absolute width & height, while the second mapframe uses relative width (100%). While the first renders ok,. the second map
*has enlarged pins
*does not cover the enclosing area for all pins

playing around with zoom did not make any difference.

When in edit - preview mode, the rendering of both maps is ok. So there is also the flaw that preview does not show what finally is shown when the file is saved.

Event Timeline

thiemowmde triaged this task as Low priority.EditedJan 8 2024, 11:28 AM
thiemowmde added subscribers: thiemowmde, TheDJ.

I'm afraid this is by design. This is just how a 100% width map in static mode works. You can see the effect better when you resize the browser window. When you make the browser window very narrow the second map is almost identical to the first.

Screenshot from 2024-01-08 11-45-20.png (902×583 px, 386 KB)

But not when the browser window is very wide. This is when we see the effects you describe. The static .png image is scaled so it fills the rectangle as best as it can, with the rectangle being 100% of the available width and a fixed 400px height. That's just how it looks then.

Screenshot from 2024-01-08 11-45-39.png (901×1 px, 761 KB)

The fact this behavior is very different in dynamic mode (which is how the preview is rendered) is also by design. Unfortunately I'm not sure what we can improve here, and how. I agree the preview is weird. We could try to improve it so it behaves more closely to how the static rendering will look like. But this won't solve the other issues, like the enlarged pins.

The probably best option we have is to dramatically increase the hard-coded width of the .png image that is used to represent a "full" width map. This is only 800px ever since the feature was introduced in 2016, see T145014. I think this can easily be increased to something like 1600px, 1920px, or even 2560px (the biggest $wgImageLimits). This would dramatically reduce the weird scaling effects.

The probably best option we have is to dramatically increase the hard-coded width of the .png image that is used to represent a "full" width map. This is only 800px ever since the feature was introduced in 2016, see T145014. I think this can easily be increased to something like 1600px, 1920px, or even 2560px

Turns out that node_mapnik has a builtin default limit of 2048. With retina screens, that means 1024 is the current max (well technically, there could be screen higher than 2x of course,, but I don't think we allow leaflet to present a higher density than 2x).

Change 991035 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Turn hard-coded 800px for full-width mapframes into config

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

Change 991037 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Increase $wgKartographerStaticFullWidth to 1024

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

Yes, 1x and 2x are the only values we currently allow. Looks like you are right, unfortunately. When I manually test this it does indeed stop working after 1024@2x. To bad. But 1024 is already a notable improvement.

Change 991035 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Turn hard-coded 800px for full-width mapframes into config

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

Change 991037 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Increase $wgKartographerStaticFullWidth to 1024

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

For reference, here is a direct comparison of the old 800px vs. the new 1024px setting. It's not a massive improvement, but already better.

Screenshot from 2024-01-08 11-45-39.png (901×1 px, 761 KB)

Kartographer_full_width_1024px.png (901×1 px, 718 KB)

Change #1029111 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Make client code use $wgKartographerStaticFullWidth as well

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

Change #1029111 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Make client code use $wgKartographerStaticFullWidth as well

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

I suggest to close this as resolved. As explained above this is just how static maps work. The only additional thing we could do is to increase the image size further, but as mentioned this is unfortunately not possible with the currently used software versions.

TheDJ claimed this task.

I agree. Maybe we should add a note to the documentation of full/100% though, to mention that there are some limitations with static maps ?