Page MenuHomePhabricator

Mapframe static thumbnail taking a long time to generate
Open, Needs TriagePublic

Description

The static map thumbnail images, shown when viewing a page with a mpaframe map, seems to be taking a long time to be generated/shown. At my sandbox (at enwiki), I made this edit at 23:03 UTC.
This added a map with two point features, via templates/modules. The equivilent wikitext for the mapframe map, by expanding templates, is

<mapframe height="200" frameless="1" align="center" width="290">[
{"type":"Feature","geometry":{"coordinates":[-83.00208694,39.962375],"type":"Point"},"properties":{"description":"39.96237500°N 83.00208694°W","title":"[[LeVeque Tower|American Insurance Union Citadel]]","marker-color":"5E74F3"}},
{"type":"Feature","geometry":{"coordinates":[-82.997111,39.942111],"type":"Point"},"properties":{"description":"39.942111°N 82.997111°W","title":"[[Krumm House|Krumm House]]","marker-color":"5E74F3"}}
]</mapframe>

Half an hour later, along with multiple purges, null edits, and a dummy edit, the page looks like this when viewed (left) and previewed in the wikitext editor (right):

Mapframe thumbnail (view and preview).png (741×1 px, 215 KB)

The preview of course uses a dynamic map rather than static image, so shows the two point features as expected. When viewing the article, the expected result is the same or very similar view but as a static image, but instead the zoomed-out world map is displayed.
I'm guessing that generating the static thumbnail image is taking a very long time, and that a default worldwide view is being shown instead.
For some reason, maybe bad caching or a race condition, an empty GeoJSON layer is initially being used instead of the actual GeoJSON when generating the static thumbnail; if no coordinates are explicitly set, this results in the default map being rendered.

The same thing happens at https://en.wikipedia.org/wiki/User:Evad37/Sandbox_10, which is using the mapframe tags directly rather than via templates/modules.

A very similar mapframe map, but with like 168 other point features, is currently displaying correctly for me at National Register of Historic Places listings in Columbus, Ohio, but a few hours ago another user reported that the map was broken (at https://en.wikipedia.org/wiki/Template_talk:NRHP_row#Wikidata_coordinates)

Event Timeline

Having checked again just now, 1:27 UTC, the thumbnail is now displayed correctly on both of my sandbox pages linked above.

Actually, the description of how the static image is generated is not accurate, the "default map" rendering happens when an empty GeoJSON is used to render the map and no coordinates were explicitly set for the mapframe.

The GeoJSON used to create another layer in the static map comes from either geoshapes service or mapdata lib requesting WDQS/MW. On Kartographer side, the data is collected from the ParserOutput.

This could be related to T158657: Kartotherian error: GroupId not available, which IMO is being caused by bad caching or some sort of racing condition in this issue.

Two weeks ago I described similar examples in T268927#6655678, as the issue in that task seemed at least partly the same. Earlier, on November 17 I added maps with geoline/geoshape to nearly 100 Wikipedia articles and then all snapshots (static images) were generated/served correctly right after saving, which also was the case before that date, as far as I can remember. So I'd say this issue has surfaced recently.

I'm not sure if it's useful to point this out here, but now I added mapframe with geoline to 134 articles, and interestingly correct snapshot image, with the geoline object on it, was available right away after saving for all except one – article that was most recently created. For the latter correct snapshot appeared about an hour after saving. Though, Wikidata ID on OSM for it was added along with 10s of other objects that appeared right away on snapshot, and via geoshape service it was also available right away. In past days I had problems with retrieving correct snapshot timely in some other more recently created articles like this one.

Something interesting: If the size of the mapframe is adjusted, e.g. <mapframe height="200" to <mapframe height="201", then the static map is immediately generated correctly - and undoing causes the worldwide static map to appear again. It would appear the snapshot service is initially fed bad data (perhaps checking for group ids before they have been generated/saved?), and then that bad image is cached for a couple of hours.

@MSantos: Is there any way for the snapshot service, if it receives empty GeoJson, to either

  • try making the request again, perhaps after a short delay, to give whatever is generating/saving the missing data a chance to complete its work; and/or
  • mark the bad image as not-to-be-cached, or cached for a much shorter time span, so that the next load generates a correct image?

... now I added mapframe with geoline to 134 articles, and interestingly correct snapshot image...

I forgot to mention that I used a bot account (pywikibot). Now after having edited/added bunch of other maps, my impression is that correct snapshot is generally available right away after saving if I edit via bot account, and otherwise not. Does this imply anything useful?

On ca.wiki it is reported that static maps are not rendered when you previously preview the dinamic map. It works fine if you save it without a preview. To reproduce it:

  • Check you don't have preview by default in your preferences.
  • Copy and paste de mapframe json of the description in a sandbox.
  • Click the preview button. It shows the correct map.
  • Save it. It shows a blank map.
  • Edit it, i.e. change height. Save without preview. It renders the correct static map.

Another weird thing that I have noticed is that if you change the zoom level of your browser, the details appear on or disappear from the map.

For example, I can see the details of the map in this article if I set the zoom level at 100%, but if I change it to, say, 130% the details disappear.

It's really necessary to use static thumbnail? Other WikiMedia projects, like Commons or Wikiviajes, do not use them. They load the interactive map directly.

It's really necessary to use static thumbnail? Other WikiMedia projects, like Commons or Wikiviajes, do not use them. They load the interactive map directly.

Good idea.