Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Interfacing Perl and SVG

by Matts (Deacon)
on Aug 14, 2002 at 07:48 UTC ( #190002=note: print w/ replies, xml ) Need Help??


in reply to Interfacing Perl and SVG

If you're doing the highlighting client-side (via rollovers) I'd just use the SVG DOM for it. Unfortunately perl doesn't have a fully capable SVG parser yet (though AxPoint contains an SVG path parser which you may find useful - that's probably the hardest part), so in order to get at those bits you're better off doing it client side.

Unlike HTML, SVG has a very stable client-side Javascript spec, and works very well in the Adobe viewer (using the mozilla javascript engine).

If that doesn't cover what you're after, then yes, parse with a SAX parser and extract the paths. I don't know how they'll be done in your SVG (there are various different ways in SVG to define a path).

The other thing to do is to hand-refine your SVG, so that each region is a <g> group. Then you can do funky things with those groups like enlarge and bring them forward as you mouse over them. There's been some good examples of this on XML.com.


Comment on Re: Interfacing Perl and SVG
Re: Re: Interfacing Perl and SVG
by Baz (Friar) on Aug 14, 2002 at 16:31 UTC
    Thanks Matts,

    I've now defined my paths inside the "def" tags so I can make use of the "use" tags which allow me to display multiple versions of my map. I was thinking of making all the dynamic values, such as the type of fill required for each county, part of a Javascript array. That would make the parsing procedure much easier, as I'd just have to stick this in at the top somewhere.

    I was also wondering about whether it would be possible to send the SVG version to the client - which is a large file at this stage, and then for each statistical set (same maps, but with new shadings) I could send them this array. No idea as of yet how this might be done... For my site I have a list of surnames, and I shade a map to show the distribution of a selected surname. Here the current png version of this

    Thanks,

    Barry.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://190002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-09-17 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls