Community Wishlist Survey 2017/Multimedia and Commons/Support CSS files associated to SVG as media files

From Meta, a Wikimedia project coordination wiki

Support CSS files associated to SVG as media files

  • Problem: There are a number of svg maps presenting statistical information or locations for countries or regions. Every time a new information is presented the map is duplicated and adapted to the information to be shown. This leads to several problems: (1) increases the size of data to be stored - the same geographical information is copied every time (2) requires skills to manipulate these images using software or knowledge of the svg format and (3) requires several images to be corrected if the basic geographical information is changed. As an example the following maps are based on the same geographical information but present different data. Each time the map of 12 MB is copied and modified:

CSS files associated to svg images can be used to present information without changing the svg file. Entities from the picture can be coloured using their ids in a separate file. This file than can be used in association with the basic svg as a picture instead of creating new image every time. A simple text editor can be used to manipulate data given that the basic svg is formed in a convenient manner.

  • Who would benefit: Wikimedia Commons, editors
  • Proposed solution: Allow CSS files associated to svg files to be used as media.
  • More comments:
  • Phabricator tickets:

Discussion[edit]

Probably doable with the Graph extension? Ping @Yurik: --Tgr (WMF) (talk) 00:41, 20 November 2017 (UTC)[reply]

Yes and no. I don't think you can customize the SVG files, BUT you can store the file as geojson (using .map on commons), and customize its visualization (e.g. specify which region should be shown with what style). Also, graph could allow you to draw an image, and draw things on top of it. --Yurik (talk) 20:14, 20 November 2017 (UTC)[reply]
Hi, thanks for the comments. I think Graph is a good tool and may be very useful. I do not know how practical will be to present the examples above with 36538 occurrences of polygon elements. --Ikonact (talk) 09:23, 21 November 2017 (UTC)[reply]
This would depend on whether our SVG renderer (librsvg) can support external CSS. I'm not sure whether it can or not. Would be good to test. Ryan Kaldari (WMF) (talk) 23:07, 20 November 2017 (UTC)[reply]
That's a good question. I suppose a way to do this is to save locally the svg file with the css included before render it. --Ikonact (talk) 09:23, 21 November 2017 (UTC)[reply]
Note, we intentionally disable network support in librsvg for security reasons (Which is why for example including external images aren't supported except by data: uris). BWolff (WMF) (talk) 23:04, 28 November 2017 (UTC)[reply]

This is a cool use case but I'm not sure how the implementation would look - we don't have any clean way of handling multiple files as one media item, and working around that would make our media handling code more hacky, and it's already a DX horror show. So I am mildly against this - maybe in a few years it can be implemented cleanly on top of MCR --Tgr (talk) 06:31, 28 November 2017 (UTC)[reply]

It would also mean that users would not be able to download a standalone file that just worked, which seems unfortunate. BWolff (WMF) (talk) 23:04, 28 November 2017 (UTC)[reply]
Can still screen-grab it.  — SMcCandlish ¢ ≽ʌⱷ҅ʌ≼  08:00, 4 December 2017 (UTC)[reply]

I would REALLY appreciate this -- I recently made a similar wish in the German WP (or at least parked it because I missed the deadline). -- Christallkeks (talk) 13:00, 6 December 2017 (UTC)[reply]

If anyone's still watching this: I submitted a wish very similar to this one for this year's survey -- Christallkeks 30th October 2018

@Viciarg, Ikonact, Liuxinyu970226, Draceane, Iliev, Thomas Obermair 4, Donald Trung, Swpb, Giovanni Alfredo Garciliano Diaz, Uglemat, Alexmar983, Talmoryair, LikeLifer, Reneman, Psychoslave, Martin Kraft, and יונה בנדלאק: Sorry for the spam, but you may want to vote on my very similar wish for this year's survey: VOTE HERE -- Best wishes, Christallkeks (talk) 13:23, 17 November 2018 (UTC)[reply]

Voting[edit]