Page MenuHomePhabricator

it:voy needs Kartographer to shows ordered POI on specific template
Open, LowPublic

Description

Kartographer associates incremental POI according to their position inside the wikicode, but in it:voy we use some LUA templates that alphabetically order their content.
What we need is to implement the same LUA sort function inside Kartographer, to be used everytime those template are called otherwise there is a discrepancy between the POI numbers inside the article and the POI numbers shown in the map

Templates:

Module:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 29 2017, 8:04 AM
MaxSem added a subscriber: MaxSem.Nov 29 2017, 8:33 AM

You can already specify the marker symbol directly:

<mapframe width="350" height="350" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478">
{
  "type": "Feature",
  "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] },
  "properties": {
    "marker-symbol": "3",
    "marker-size": "small",
    "marker-color": "0050d0"
  }
}
</mapframe>

One problem is that although the specification allows only one numeric character per marker, the tile server supports 2 however Kartographer is being true to the spec and doesn't permit 2 digits - that is, however, trivial to fix. Would this solution work for you?

Change 394020 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/Kartographer@master] Allow 2-digit numeric markers

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

debt moved this task from Backlog to Needs review on the Maps-Sprint board.
debt added a subscriber: Fjalapeno.

@MaxSem can your patch be integrated into the LUA script mentioned above?
In the affirmative case it could be an efficient patch, otherwise the same LUA order function should be inserted inside the extension and activated any time the above templates are used inside the wiki-code.

MSantos added a subscriber: MSantos.Jul 3 2018, 4:41 PM
Mholloway triaged this task as Low priority.Sep 25 2018, 3:51 PM
Mholloway moved this task from Unsorted to Wikivoyage on the Maps (Kartographer) board.
TheDJ added a subscriber: TheDJ.

@Andyrom75 just wondering what the status of this is. Is there anything still needed to fix your problem ? Do you have an example page with the problem ?

@TheDJ as a mere example you can look at https://it.wikivoyage.org/wiki/Lago_di_Garda#Centri_urbani
In that article there is 3 occurrence of Template:Destinationlist. First 2 are already alphabetically ordered inside the wikicode, so the markers near the text and the map are fine.
The third occurrence is not alphabetically ordered on the wikicode so I've hidden the marker on the the text because the ones on the map (look top right) wouldn't match.

Can someone take it in charge?

So Template:Citylist (implemented using module:itemlist), wrapping listing templates, wrapping marker templates, which in turn invoke the Map module. The list function re-sorts, but has no way of passing this information to the individual items.

This is a common issue. You can't tell the parent to do something different with the children after the children have already been parsed. Don't rely on code to resort 'unpredictable' input, instead provide the 'counter/tipo' argument to the 'listing' you want to change to override the value it will otherwise autogenerate so for instance "tipo=see-22" (I think).

Also note that wikivoyage is not instantly updated sometimes. It uses its own (highly inefficient) POI-api instead of the Kartographer layer.

@TheDJ it's clear that the extension works on the original wiki-code (let's call it "unsorted") but an idea that would solve this issue, is to implement the same sorting script inside the extension and when it recognize the presence of certain templates (e.g. Template:Citylist), it applies this sorting function before rendering the final HTML code.
I think it will work in this way. Isn't it?

I'm not sure I got your last note. Are you referring on template:MappaDinamica? In the affirmative case, we are using it because of the current limitation of two-digits-markes (see T141335). I've currently patched with a script and I'll be more than glad to eliminate the patch and upgrading to the K-layer.