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

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

⬅ Back to Multimedia and Commons The survey has concluded. Here are the results!

  • 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:
  • Proposer: Ikonact (talk) 14:54, 14 November 2017 (UTC)


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

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)
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)
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)
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)
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)

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)

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)
Can still screen-grab it.  — SMcCandlish ¢ ≽ʌⱷ҅ʌ≼  08:00, 4 December 2017 (UTC)

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)