Note that there are some explanatory texts on larger screens.

plurals
  1. POSuggestions on manipulating an SVG map
    primarykey
    data
    text
    <p>I'm working on a map of the native languages of California for Wikipedia. The map contains areas that each correspond to a language. The original looks like this (click it to see the <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics" rel="nofollow noreferrer">SVG</a>):</p> <p><a href="http://en.wikipedia.org/wiki/File:California_languages_precontact.svg" rel="nofollow noreferrer"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/California_languages_precontact.svg/200px-California_languages_precontact.svg.png"/></a></p> <p>I want to make "locator maps" for each of those individual languages by hand (in <a href="http://en.wikipedia.org/wiki/Inkscape" rel="nofollow noreferrer">Inkscape</a>), like this one, for a language called <a href="http://en.wikipedia.org/wiki/Cahuilla_language" rel="nofollow noreferrer">Cahuilla</a> (which has the language code <code>cah</code>):</p> <p><a href="http://en.wikipedia.org/wiki/File:Cahuillia_language_with_California_inset.svg" rel="nofollow noreferrer"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/Cahuillia_language_with_California_inset.svg/200px-Cahuillia_language_with_California_inset.svg.png"/></a></p> <p>Needless to say, doing this would be a pain in the neck if I generated all 60-some by hand in Inkscape. </p> <p>Worse, whenever I find a mistake in the original, I'd have to redo the whole set of locator maps. (And in fact I recently realized that my original is missing one language entirely. Sorry Cupeño.)</p> <p>So my goal is to automate this process. I don't have much experience processing SVG or even XML, so I'm looking for recommendations as to which libraries would be most helpful. I'd prefer solutions in Python, sincely I'm not hopeless in that language.</p> <p>To summarize, I need to:</p> <p>Get a list of references to all the language shapes in the original SVG file.</p> <p>For each language in this list:</p> <ol> <li><p>change the background color of the shape for the current language</p></li> <li><p>put a box around the language</p></li> <li><p>duplicate the box and scale it to a given size (I recognize that in this step it might be difficult to actually "crop" the surrounding shapes as I did in my example -- just creating a box with the language shape on a white background would be sufficient.)</p></li> <li><p>place the duplicate in the upper right corner</p></li> <li><p>save all this stuff in code.svg</p></li> </ol> <p>The final product will then be 60 SVG files named <code>cah.svg</code>, etc. Better yet, it would be possible to re-generate the whole shebang if it became necessary to edit the original map (which is quite likely). </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload