Groups with non-zero intersections

I'm pretty new to SVG and am trying to figure out a solution to what I think
would be a fairly standard problem.

The problem is how to highlight routes on a road network, given that
multiple routes may have zero or more roads in common.

Before reading the SVG specification, my plan was to define the roads
individually with unique identifiers, and to then create groups that
referred back to those identifiers.  In other words (and mutilating
syntax)...

<line id="road1" ... />
<line id="road2" ... />

<group id="route1"> reference-to-road-1 </group>
<group id="route2"> reference-to-road-1, reference-to-road-2 </group>

Then I was going to do the equivalent of "Set all lines in group 'route2' to
green".

Based on my reading of the specification this isn't possible using the "g"
element, as the sets defined by different "g"s must have no intersections.
The "use" element looked interesting, but I got the impression that copies
the element, which would mean that I would have multiple lines being
rendered, which seems to be a waste.

I though about specifying the route using a class, eg.

<line id="road1" class="route1 route2 ... " .../>

I could then mess with the class to make my changes.  This doesn't feel too
bad except for one problem: I am looking at 30,000 routes and about 10,000
roads.  I'm a little worried that using classes might be a bad idea,
although I don't yet know the maximum number of routes (classes) in which a
particular road will be a member.

Any suggestions on the "right" way to handle this kind of problem would be
greatly appreciated.  Ideally my interpretation of the "use" element is
completely wrong and using it does not create multiple instances of the
element, in which case this was a lame question all around.

Thanks for your help,

Jason Foster

Received on Saturday, 27 October 2001 22:46:11 UTC