Page MenuHomePhabricator

<mapframe>: Automatic zoom and centering of ExternalData only works with interactive maps, not static maps
Closed, DuplicatePublic

Description

For ExternalData (geoshape/geoline, or Commons .map page), a mapframe map that doesn't specify coordinates and/or zoom in the tag will not automatically zoom and center the map if static maps are enabled, but will work with interactive maps. Due to T203863, this difference is easily noticeable when comparing a saved page (showing a static map) with a preview, from wikitext edit mode, of that page (showing an interactive map).

Geoshape example
https://sv.wikipedia.org/w/index.php?title=Furillen&oldid=40697838

<mapframe text="Furillen markerad med grått i kartan." zoom=11 width="200" height="200" >
{
  "type": "ExternalData",
  "service": "geoshape",
  "ids": "Q1474958"
}
</mapframe>

Geoline example
https://www.mediawiki.org/wiki/User:Evad37/sandbox/mapframe

Mapframe example
<mapframe text="Mapframe example" height="200" width="300">
{
  "properties": {"stroke-width":6,"stroke":"#ff0000","title":"ExpandTemplates"},
  "type":"ExternalData",
  "service":"geoline",
  "ids":"Q1094308"
}
</mapframe>

Commons .map page example
https://nl.wikipedia.org/w/index.php?title=Wikipedia:De_kroeg&oldid=51923141#%3Cmapframe%3E

<mapframe width=300 height=300 zoom=17>
{
  "type": "ExternalData",
  "service": "page",
  "title": "Haarlem/Grote Kerk.map"
}
</mapframe>

Event Timeline

Nirmos created this task.Feb 19 2018, 6:58 PM
Restricted Application added a project: Discovery. · View Herald TranscriptFeb 19 2018, 6:58 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Nirmos updated the task description. (Show Details)Feb 19 2018, 7:06 PM
Gehel edited projects, added Maps (Kartotherian); removed Maps.Feb 19 2018, 7:12 PM
Gehel added subscribers: jmatazzoni, Gehel.

@jmatazzoni I have no idea what this is (except that I can reproduce the issue). This looks Kartographer related more than Kartotherian / tilerator. Can we prioritize this high (or higher) in the collab team work?

It looks like Kartographer is deliberately loading ext.kartographer.staticframe instead of ext.kartographer.frame, but staticframe doesn't seem to work correctly.

I can reproduce this bug locally by setting $wgKartographerStaticMapframe = true; in my config.

I can reproduce this bug locally by setting $wgKartographerStaticMapframe = true; in my config.

That was a red herring, it wasn't working because my test domain isn't whitelisted by the server. In production, static maps do work correctly, but only if the coordinates are specified. The map on the Furillen page doesn't specify the coordinates directly but uses a Wikidata Q-ID, and that doesn't work with static maps. See https://sv.wikipedia.org/wiki/Användare:Roan_Kattouw_(WMF)/Sandbox

It looks like dynamic (i.e. non-static) maps have a feature whereby they automatically center shapes drawn onto them if you don't specify a lat/long, but static maps don't have this feature. If you change zoom=11 to zoom=3 in your example you'll see that the map isn't actually broken, it's just centered on an area in northwest Africa while the shape you're drawing is in Sweden.

It seems to me that specifying a map using only a Wikidata ID without setting lat/long, like the Furillen page does, is fundamentally incompatible with static maps (unless we do a fair amount of server-side work), and I don't see how it could ever have worked. Maybe other uses of this tag do specify lat/long? Was the way svwiki uses these tags changed recently?

To clarify: the Furillen page should work just fine if you specify lat/long.

Catrope reopened this task as Open.Feb 27 2018, 6:28 PM

Turns out this is not actually a duple of T155927. That bug is about maps with Wikidata usage in external .map pages, while this bug is about static maps not centering themselves in the right place when using a Wikidata ID. It is, however, related to T178321: Template: Maplink — add ability to use lat/lng or Wikidata Qid for a point .

Catrope renamed this task from mapframe no longer works to <mapframe> with a Wikidata QID but no lat/long does not center itself if static maps are enabled.Feb 27 2018, 6:31 PM
Mholloway triaged this task as Normal priority.Jul 10 2018, 4:26 PM
Evad37 renamed this task from <mapframe> with a Wikidata QID but no lat/long does not center itself if static maps are enabled to <mapframe>: Automatic zoom and centering of ExternalData only works with interactive maps, not static maps.Sep 20 2018, 4:25 AM
Evad37 updated the task description. (Show Details)
MSantos moved this task from Unsorted to General on the Maps (Kartographer) board.Sep 25 2018, 3:09 PM
Pikne added a comment.EditedOct 30 2018, 11:33 AM

T158919 seems to be related. Will that task also solve this task here?'

Edit: Indeed, above examples work now that patch from T158919 is deployed.
Thanks for figuring this out!

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptNov 9 2018, 12:04 PM