Discussion:
Adding SVG to SVG
Roger Bell_West
2018-08-17 19:14:47 UTC
Permalink
I have two SVG files. Let's call them "map" and "counter". I want to
produce a third file, with "counter" visible on "map". (Probably with
other stuff added round it.)

I've looked at SVG::Parser, and I can decompose "map" into an SVG
object, modify it, and reassemble it. That looks like the right way of
going about things.

But the image method of SVG doesn't embed the content from "counter",
but rather drops it in as a hyperlink, which isn't what I want - the end
result needs to be a single file that doesn't refer to any others.

I've also tried adding a suitable SVG::Element from "counter" into the
"map" structure, walking the parse trees to try to find the right thing
to add and a place to add it, but I'm not getting anywhere with that.

"Using SVG, you can generate SVG objects, embed other SVG instances into
it, access the DOM object, create and access javascript, and generate
SMIL animation content." says the documentation. I specifically want to
embed other SVG instances into it. But I can't see how this is supposed
to work.

Any suggestions?

Roger
Julien Fiegehenn
2018-08-21 19:59:19 UTC
Permalink
Hi Roger,

this comes a bit late but let's see if I can still help. Could you please
provide two small example files? I've done some work on SVG files in the
past using Perl and would like to give it a try.

Thanks,
Julien
Post by Roger Bell_West
I have two SVG files. Let's call them "map" and "counter". I want to
produce a third file, with "counter" visible on "map". (Probably with
other stuff added round it.)
I've looked at SVG::Parser, and I can decompose "map" into an SVG
object, modify it, and reassemble it. That looks like the right way of
going about things.
But the image method of SVG doesn't embed the content from "counter",
but rather drops it in as a hyperlink, which isn't what I want - the end
result needs to be a single file that doesn't refer to any others.
I've also tried adding a suitable SVG::Element from "counter" into the
"map" structure, walking the parse trees to try to find the right thing
to add and a place to add it, but I'm not getting anywhere with that.
"Using SVG, you can generate SVG objects, embed other SVG instances into
it, access the DOM object, create and access javascript, and generate
SMIL animation content." says the documentation. I specifically want to
embed other SVG instances into it. But I can't see how this is supposed
to work.
Any suggestions?
Roger
Roger Bell_West
2018-08-21 20:28:49 UTC
Permalink
Post by Julien Fiegehenn
this comes a bit late but let's see if I can still help. Could you please
provide two small example files? I've done some work on SVG files in the
past using Perl and would like to give it a try.
Really, any two files created in Inkscape would do - one with a small
piece of content, the other with a layer into which said content should
be placed (or it could all go into a new top layer, I'm not fussy). But
I'm working with other people's Inkscape-generated files rather than
being able to create all my own stuff from scratch.

This is not at all urgent now, because I built a program to do the same
thing using Imager, generating bitmaps at arbitrary scale.

R

Loading...