[ka-Map-users] Technical alternatives for SVG on IE

Robert Thau rst at alum.mit.edu
Fri Apr 28 10:27:46 EDT 2006


Hi... I've noticed the recent conversation here on SVG overlays.  As a
possible point of interest, Internet Explorer can display vector
graphics *without* a plugin --- but not in SVG.  Instead, it supports
its own, effectively proprietary, XML graphics description language
called VML.  (Some Microsoft documentation refers people to a copy of
the spec at http://www.w3.org/TR/NOTE-VML --- but that's a discussion
draft that the W3C more or less ignored).  

The advantage of this is, obviously, you aren't requiring users to
download a plugin.  The disadvantages are two: you're supporting two
vector graphics formats, one of which (VML) does *not* have native
support in, say, PostGIS --- and also, the VML engine actually gets
kind of slow when there are large numbers of mouse-sensitive overlays
on the screen.  But for just, say, putting a few lines or polygons
on a map, it's fine.

One other point --- I never tried <embed>, but I did try embedded SVG,
using <object> tags in Firefox.  The result was behavior which I
*think* I've seen described here: the SVG objects seem to "soak up"
mouse events, so clicking on them (or dragging over them) doesn't work
as you expect.  The reason for this, near as I could tell, was that if
you do that, the SVG is considered to be part of a logically separate
document, as if it had been loaded into an <iframe>, so mouse events
do *not* bubble up from the SVG elements to the <object> tag and its
enclosing HTML elements.  To make it work at all, I had to add
handlers on the SVG nodes which, in effect, forwarded the mouse events
up the chain --- and even then, you got messy visual artifacts while
dragging the map.

I found inline SVG (just including <svg> tags directly in the body of
an HTML document) to work a whole lot better --- event propagation works
as you'd expect, and the artifacts don't show up.  However, in Firefox
1.5, this requires the document you're serving to be strict XHTML
(and declared as such --- content-type "application/xhtml+xml");
in this mode, close tags are mandatory, <br> *must* be typed as <br/>,
uppercasing of tag names doesn't work, and so forth.

(Brief plug: I've used a mixed inline-SVG/VML approach to graphics
overlays in a GPLed project of my own, IvyGIS, which can be loosely
described as "PostGIS and Mapserver on Rails and Scriptaculous"; if
interested, see http://ivygis.justec.co.in/ for more.  Unfortunately,
the demo is a bit slow at the moment due to network difficulties in
Tokyo --- however, I'm hosting up the FGS modules containing the code
on a server in New York, and installing that goes pretty quick).

Robert Thau
rst at alum.mit.edu


More information about the ka-Map-users mailing list