Template talk:Graph:Street map with marks

About this board

MSGJ (talkcontribs)

Is there any way to label the points when getting the coordinates from a Wikidata query?

Is there any way to change the marker shape when getting the coordinates from a Wikidata query?

Thanks!

Reply to "Question"

Awesome improvement to text resolution

2
RobinLeicester (talkcontribs)

Not sure when or how the improvements to rendering on the maps took place, but the end results, especially for small text sizes, are awesome. Thanks to those who made that happen. It is a vast improvement in useability.

RobinLeicester (talkcontribs)

So it turns out that the improvement is the result of WMF shutting down graphoid (https://phabricator.wikimedia.org/tag/graphoid/) which used to render the maps and just pass on a fairly low-res image. This happened during early 2021 I think, but it is not clear if anyone looked at the implication for the mapping stuff. The improvement in clarity of the maps is massive, but at what download and resource cost?

With graphoid there was no overhead to adding as many markers, details, items etc as an editor wanted. Is it now rendered from scratch every time? and what is the implication for mobile data users in particular? If anyone can offer an observation or reassurance on these points (maybe 'varnish' can keep it all in bounds?). I note some references to 'maps 2.0' https://phabricator.wikimedia.org/T280767, being worked on, so we may have to see what is coming next.

Reply to "Awesome improvement to text resolution"

Problem with maps in mobile version pages

7
RobinLeicester (talkcontribs)

It has become apparent that the 'graph' originated maps are having trouble displaying on the mobile version of en:wikipedia. I have narrowed the problem down to maps that are in a subsection of the page. If it is in the opening section/lead there is no problem - and they all display fine on the 'normal' wikipedia. But on the mobile version of a page, the ones in a subsection just display as empty boxes. You can see this in my sandbox. The one at https://en.wikipedia.org/wiki/User:RobinLeicester/sandbox havefive different maps, including one direct from Graph:Street map with marks, and one using template:maplink. Whereas the mobile version https://en.m.wikipedia.org/wiki/User:RobinLeicester/sandbox displays the first map (above the 'rest' subsection) and displays the maplink one, but all the others are just white boxes. My guess is that this is related to the way the graph template expects to find the rendered image, and presumably the mobile sections do something non-standard that messes it up. If anything can be done to resolve it, that would be great.

RobinLeicester (talkcontribs)

After a look at some of the source code on the pages affected, I would guess it is to do with the 'lazy image loading' feature failing to find the rendered image. @Yurik, Is this something you may be able to look at?

RobinLeicester (talkcontribs)

A bit more digging around the html properties of affected mobile pages (and bearing in mind that I don't really understand the mechanics of html or the lazy loader) has revealed that the 'active' part of the src instruction (as opposed to the <noscript> part) reads as

<img width="0" height="0" class="mw-graph-img image-lazy-loaded" alt="" src="/api/rest_v1/page/graph/png/....png" srcset style>

So the reason nothing is visible is that there is no width or height. But I have no idea how the lazy loader finds these sizes, or why it is failing.

Comparing this to a commons image, this has

<img width="400" height="300" class="thumbimage image-lazy-loaded" alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/53/....jpg" srcset="" style="width: 400px; height: 300px;">

RobinLeicester (talkcontribs)

I have now posted this problem on the German version of Module:Graph, as it seems to affect all Graph based images, and that seems to be the 'lead' version.

RobinLeicester (talkcontribs)

There is a phab:T216431 which describes this but has not so far resulted in any progress.

RobinLeicester (talkcontribs)

A fix has been discovered by Nehme1499. Graph:Chart seems to have found a way to switch off the lazy loader (or resolve the issue by whatever means) and simply including a pie chart of zero size is enough for any other Graph: based templates on the same page to also work in mobile view.

RobinLeicester (talkcontribs)

A Css fix was the real solution, which inherits the width values etc, and means lazy loader is retained and works as it should. I have applied this via an associated styles.css file. More details at phab:T216431

Reply to "Problem with maps in mobile version pages"

Internationalized names

3
RobinLeicester (talkcontribs)

Is there any chance that the Maplink 2018 improvements to internationalised names could find their way on to this system as well? To have the new default of 'language of the wiki', even without all the additional versions, would be a huge improvement over the current version for pretty much everyone. (If retaining the current 'osm-intl' it probably could be renamed as osm-local to match the mapframe usage). The no-labels 'osm' style has also been heavily requested and I have found useful, so to end up with all three would be great.

Yurik (talkcontribs)
Yurik (talkcontribs)

P.S. @RobinLeicester I would suggest filing a Phabricator ticket for this (and add alink to the code) - much more likely it would be acted on.

Reply to "Internationalized names"

marks with a hyperlink

4
RobinLeicester (talkcontribs)

Yurik, thanks for sorting out the no-labels style. Will it automatically migrate to en:wiki at some point? Another feature that would transform the mapswould be if they could be given an extra layer which defines some wikilink areas above the marks. I guess this might be possible with <imagemap>, but that requires an image name, which can't be done outside the graph template. Is there some way this might be achieved? (When the election dust settles...). Thanks.

Yurik (talkcontribs)

migration = copy/paste the content of the template without any changes from mediawiki :) The overlay clickability ... might require code change for the <imagemap>, or we could use the graph's capability of click handling, but that would require the graph to be generated in SVG (there is a phab ticket for that).

Yurik (talkcontribs)

P.S. Copied.

RobinLeicester (talkcontribs)

Thanks for sorting the no labels option. That is great. The maps are already doing great things. A clickable facility would be great. (To my mind one that avoids the clunky 'play video' style launch phase would be much preferred).

Reply to "marks with a hyperlink"

Need for a no-labels option

5
RobinLeicester (talkcontribs)

Six months ago Nilfanian raised the problem of labels on the base map, and suggested that a version with no labels at all would be helpful. The problem of non-alphabetic script on en: articles was one particular problem mentioned. Arbitrary mention of obscure places at lower zoom levels is another issue, as is the bug that chops up some names in zoom=9. These are all being cited as specific reasons to not use the map on en:wikipedia (eg at WikiProject UK geography). Is there any hope of an option to turn off place names, so that editors can then use the individual marks/labels to put in the ones appropriate to the article in question. (There are of course lots of other contexts - especially at higher zoom levels - where the existing labels are a great help).

Yurik (talkcontribs)

Hi, technically the map without labels was created around half a year ago (try it) , but I am not sure it got exposed via the <mapframe/maplink> tags. For the street map template, I just added it as a template parameter, but it turns out there is a bug preventing the "osm" value for the style parameter, which I will try to fix tonight, and it should be deployed next week.
P.S. I am running for the WMF board, please support and vote next week :)
P.P.S. Tracking issue phab:T164046. Partial fix is already in place, needs to be submitted and deployed.

RobinLeicester (talkcontribs)

The base map zoom=9 label problem resolution is much appreciated. (Is it me, or are there now more place names? In busy areas is looks rather full. If I was creating a wishlist I might suggest the names could be smaller!

Looking at this graph source code, I notice that in the line with the style instruction, all the other elements have the quote mark after the '=' whereas the style has it after the '{{{style}}}'. Could that be where the problem lies? (With no knowledge of the routines this is calling, I am just stabbing in the dark though). Thanks.

Yurik (talkcontribs)

The map labels work is being done at the moment by Paul, and I think there has been an announcement about it somewhere. Due to deployment freeze this week, I think it hasn't been updated yet on the servers, so might be another week until it is fully done.

Yurik (talkcontribs)

Done - see the 3rd example. Note that "save preview" mode will not work for the next few days, until the servers are updated. The saved page should work fine.

Reply to "Need for a no-labels option"

Dataset possibilites

11
RobinLeicester (talkcontribs)

The External Dataset features look like a great way forward, whether by a more generally editable use of wikidata, or the really useful looking table in Commons. They would massively reduce the clutter that maps introduce into an article edit page. Is there a way of using the same dataset (eg a commons Data table) within <maplink>? In the Template:OSM Location Map I can automatically make use of manually inserted marks into both the graph: template and a <mapframe> link. to do the same with a table would be fantastic.

Yurik (talkcontribs)

You can use Map Data -- and reference it as External Data from the <mapframe>/<maplink>. Is that what you are looking for?

RobinLeicester (talkcontribs)

If I have understood it right, the Map Data can be used by <maplink> but not by Graph:Street map with marks, while Graph: can use the table data which is no use to <maplink>. What I am looking for is some way of using the accessible, curatable, table data on both types of map. eg, can the table data be used to generate Map Data in some automated or semi-automated way?

Yurik (talkcontribs)

This is not exactly correct. The *.map and *.tab pages in Data namespace on Commons can be used by the <graph> tag (Graph extension). Only the *.map pages can be used by the <maplink> & <mapframe> tags (Kartographer extension). The <graph> tags are Vega-based graphs, and Vega allows you to load and draw many different types of data. The "Graph:..." prefix is simply a convention for the templates that use <graph> tag. More specifically, the "Graph:Street map with marks" template (graph) was initially designed with a very specific goal - draw the street map + a few manual elements on top of it. If there is a specific need for a different graph, anyone could create a different template, and use the <graph> tag to draw a completely different image. The Vega syntax inside the <graph> tag is a very powerful, but a bit complex syntax to express such visualizations. I could try to help with getting started, but I simply cannot implement every possible graph required :)

RobinLeicester (talkcontribs)

Thanks for the helpful explanation. The table option in "Graph:Street map with marks" has already achieved my hopes for that - so that already looks great. What I was hoping for was some way of using the data from the same table to put locator points into a maplink tag (or, when it arrives at en:, a <mapframe>). My guess is that there could be a Lua routine to extract the data from a table of the sort you demonstrated, and turn it into a maplink-ready GeoJSON map file, with the marks simply shown as wikivoyage-style points (If I am using the right terminology). Unfortunately I have no idea about how to achieve that. I was only asking in the hope that it may be on someone's radar.

RobinLeicester (talkcontribs)

Further to the above, with a bit of lateral thinking, it has occurred to me that both the tab and map data could be generated by a wikipedia template using the same input as OSM Location Map, which would avoid having to worry about lua etc at this stage. Not ideal as it makes subsequent edits more tricky, but would at least provide a starting point, to see how things develop. I will have a go at implementing that and let you know how I get on.

In the mean time, the phrase about 'raw graph data' that appears at the bottom of the maps with tables will not really make sense on a map. Is there any chance of a switch to turn that off. For OSM Location map I would much rather have it under my control, so it could just say '[Data table]' or some such thing, alongside my '[Full Screen]' option, to keep the map as tidy as possible.

And I'm guessing much harder to implement ... is there any chance of having both the table and manual data, so that a general table of data can be set up for use on lots of different articles, and then the specific marks added in for each one manually as appropriate? I am guessing not,

Thanks for such a great set of tools.

197.218.82.125 (talkcontribs)

Lua can access anything data in the commons Data namespace, so it is entirely possible to construct a mapframe and graph using the same data. The only missing piece here is probably the ability to generate files using lua, and then just about anything imaginable (even files that don't exist on commons) could be placed in a map or graph or page.

https://phabricator.wikimedia.org/T66460 https://phabricator.wikimedia.org/T120489

Yurik (talkcontribs)

@RobinLeicester You could already do this with Lua - by simply loading the table by calling mw.ext.data.get(...) and generating the custom mapframe/maplink tag with any kind of content.

197.218.91.204 (talkcontribs)

While it is true that it can be done with lua, currently it is done in a rather hacky manner using stuff like {{tag: . So one has to either accept that it will never get much usage in lua, or long term a proper library like Wikibase (https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua) needs to be created for it.

The inherent complexity of graph, the fact that relatively simple graphs such as pie chart or force directed graphs aren't even available in the visualEditor (https://phabricator.wikimedia.org/T100357, https://phabricator.wikimedia.org/T100359), in addition to the issue of needing to arbitrarily concatenate graph json using strings makes it harder to be adopted in articles or lua modules.

So either lua needs libraries or visualeditor graph editing tool would need to be improved to make use of the new dataset software, or both.

RobinLeicester (talkcontribs)

Yurik, I have now produced a template 'en:template:OSM Location map from table' that both generates and then displays .tab and .map files using the OSM Location map parameters. It is pretty geeky to use, so is unlikely to be a mainstream solution, but does provide another way of generating external data for now.

The lack of features on .map files compared to locally supplied <mapframe> results is quite a draw-back though. With .map, I failed to get wikilinks and images to resolve, and the markers can't be numbered, which makes for a much weaker result, unless I am missing something. Is this still in progress? (I have put a comparison between a data:file and 'inline' maplink at en:User:RobinLeicester/sandbox . There is also an example of an 'OSM Location Map from table', which works pretty well. (If only it could have local content as well). But you will see how intrusive the 'raw graph data' line is.

Yurik (talkcontribs)

Yes, it's a big todo - Phab:T155216 (and should be relatively easy to fix)

Reply to "Dataset possibilites"
Geraki (talkcontribs)

FYI, I have used this graph template in the "Infobox building" in elwiki and now we have some dozens of articles displaying locator maps with this. It works great!

Yurik (talkcontribs)
Reply to "Used in infoboxes"
RobinLeicester (talkcontribs)

Is there any way of being able to include OSM external data directly into Graph:Street map with marks in the way you can with <nowiki><maplink>. Being able to show a particular administrative boundary, highway etc would be really valuable. Thanks.

Yurik (talkcontribs)
Reply to "ExternalData"
RobinLeicester (talkcontribs)

I have written a template called OSM Location map on en:wikipedia to put this template map into a frame, and do various other useful bits and pieces. At present it allows 10 markers to be shown, and is designed specifically for manual use, rather than the wikidata facilities you also provide. I am aware that there are probably parallel developments going on, which is fine if this gets supplanted, but it seemed like a good chance to find out how these maps might start being used. I have taken the chance to include a <maplink> link so that users can both see the static page map as optimised by an editor and link through to a more interactive one.

One strange bug I have come across is that when previewing a page under development, the labels all look very nice, with a fine-lined font, and with lots of colour options. But when changes are saved, all the labels become a clunky font instead, and most colours switch to black (or sometimes to the shape color. There are examples on the doc page for template:OSM Location map, or see . I get the same problem when calling the Graph: template direct - the labels - especially small font sizes - look far better in preview than for real.

Yurik (talkcontribs)

Fonts is an old problem we haven't solved yet - Phab:T127683. Also, graphs will soon get an automatic frame - Phab:T147768. Lastly, I really hope we will get <mapframe> to support most of these usecases eventually, so we can have the best of both worlds.

Reply to "template front end"
Return to "Graph:Street map with marks" page.