Jump to content

User talk:RobinLeicester

Add topic
From mediawiki.org
Latest comment: 8 months ago by RobinLeicester in topic Non-Vega CSS version of OSM Location map

Vega 5 dev

[edit]

I noticed @Sandizer's comment on the Graph/Plans discussion, and thought I would open a discussion here, so as not to clog up the 'plans' page. (Every time I make a comment there, it appears to be the wrong thing to say).

With the hope that, just maybe, the Vega graph thing will actually get re-instated, I have had a renewed effort in the last few days to make sense it - although certainly not an expert programmer. I am coming from a standpoint of wanting to re-instate the OSM Location map template, which is a non-graph use of Vega, so most of the examples and tutorials are at best tangential and mostly irrelevant. However, they are all I have found so far and I am encouraged by what I have started to acheive.

Main Vega page resources are:

  • vega.github.io/editor online editor/test area, that has useful instant error messaging which gives a lot of clues on the problem. Much easier, therefore, than wikipedia, which just says 'Syntax Error'.
  • vega.github.io/vega/docs/porting-guide/ incredibly unhelpful guide, unless you are already up to speed with v2. But does at least help if you are trying out some v2 code.
  • vega.github.io/vega/examples/ wierd and confusing selection, but is at least a wide variety of different use cases, so there is a chance of finding a parallel to some problem or other. The documentation pages on the same site are very useful once you know how to start using them, but have taken me a long time to start finding helpful.

The other useful fact, which I was wary of mentioning in case someone turns it off, is that there is a working Vega5 installed on a Beta WMF site, which is accessed from the graph extension, for which some useful links are at https://en.wikipedia.beta.wmflabs.org/wiki/Template:Graph,_chart_and_plot_templates Having said that, it is not a fully working installation, in that, so far as I can see it is prevented from all access to other websites beyond the Beta site itself. So no external files, and no access to maps as yet. Also, no on hover, tooltips, or clickable links as yet, but they weren't available before either. (nb Signing in to the Beta site also comes with stern warnings about using new passwords and carrying your own risks, etc.)

Much of the tinkering I have acheived so far has been using the 'marks' features of Vega, of which I have got to grips with a few at https://en.wikipedia.beta.wmflabs.org/wiki/User:RobinLeicester/sandbox . The OSM Location map that may one day fly again, hides away all the vega features, so I am trying to re-develop that approach with sub-pages that do the vega bit, based on passed parameters. Apart from the actual base-maps, the other yawning chasm in my understanding is the need to use 'projections' and possibly 'transforms' to convert the lat and lon coordinates to put the feature in the right place on the chunk of map on display. I don't understand how 'Graph:Street map with marks' acheived this in v2, and am still nowhere near knowing how v5 will do it.

If there are people with programming skills, who are willing to get their head around aspects of Vega and help make use of the graph/Vega5 facilities, that will be a vital part of justifying the effort that WMF will be putting in to get it in place. RobinLeicester (talk) 23:18, 4 October 2023 (UTC)Reply

Update on external files. Material from commons can be accessed by using the full 'File URL' shown in the commons 'Use this File' box. (Unlike previously where Graph used 'protocol' names to give access). It is not clear if this is the final strategy for V5 or if this is a stop-gap facility.
I also was pointed to a page of guidelines for Graph at https://www.mediawiki.org/wiki/Extension:Graph/Guide which includes the vital URL information for maps. By using the full URL with all the parameters concatonated, and no 'protocols', the beta site does allow maps to be displayed! RobinLeicester (talk) 19:00, 24 October 2023 (UTC)Reply
Update 2: After getting nowhere with Projection+Transform efforts to convert Lat and Lon data into useable x,y's, I now suspect the transforms of this kind only work with external data and not internal 'values'. Vega2, I finally worked out, used to return them as layout_x,layout_y. Not sure why this would be dropped, and I may be wrong, but x,y return as 'NaN' and layout_x,layout_y as 'undefined'. My solution was to grapple with mercator projections to the point where I could code them in a wiki template, and supply Graph with the finished x,y's. Very useful projection formulae+codes at https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames and https://wiki.openstreetmap.org/wiki/Mercator RobinLeicester (talk) 19:11, 24 October 2023 (UTC)Reply

Non-Vega CSS version of OSM Location map

[edit]

The on-going lack of progress with a Vega5 deployment was a spur to a more focussed investigation of alternatives. Having already brought Mercator calculations into a wikitemplate, that was one of the three 'essential tasks' extracted. Further investigation of template:maplink showed that it was indeed possible to use that to provide the base OSM map in a way that allowed material to be overlaid. The 'discovery' that there were CSS options for precisely placed shapes, lines and images was the final element that meant the OSM Location map template could be moved out of Vega altogther. That work was completed on en:wiki in early March 2024.

Undoubtedly the biggest shortcoming is text-handling. html/css tries to do 'stuff' with text, like overly-wide line-spacing at small font sizes; unrequested line-breaks near the right hand edge, and an inability (so far as I can discover) to automatically place a line of text on the left hand side of a shape. (It will be too near or too far depending on if there are wide or narrow letters in the text). Other limitations - no-labels (clean map with no names) is not (as yet) implemented in maplink, and there is the ongoing worry that expanded page-size exceeds limits if there are mutliple complex maps per page. On the upside, load-times seem hearteningly within bounds, most of the pre-existing features are back and working, and a raft of the 'new' fetaures developed for the Vega5 version could also be implemented in CSS, so that is quite an outcome. RobinLeicester (talk) 12:48, 27 March 2024 (UTC)Reply