[OpenLayers-Dev] Developement of an external vector symbol

Cameron Shorter cameron.shorter at gmail.com
Wed Nov 14 17:09:18 EST 2007

I don't think we should be translating between SVG/VML in javascript as 
it will slow down rendering.
I expect that usually SVG/VML can be translated before running the 
If effect you would have a directory of svg icons and vml icons with the 
same names and you switch directories at runtime depending upon which 
browser is being used.

Pierre GIRAUD wrote:
> Hi all,
> This morning, I had a review on the Barbara's code with some tiny clean-up.
> The code works great at the moment.
> There is still one thing to be fixed. Currently, the codebase to
> convert SVG symbols to VML has been put into the VML.js file as global
> functions such as "convertSVGToVML". This isn't really clean.
> What about having a new Format.SVG class with a convertToVML method ?
> Any other suggestions ?
> Regards,
> Pierre
> On Oct 26, 2007 4:32 PM, Barbara Philippot
> <barbara.philippot at camptocamp.com> wrote:
>> Thanks for your advice Cameron!
>>     I researched available tools to transform SVG into VML. I found that
>> only one project was usable without too many modifications : Mark
>> Finkle's opensource project : Implementation of simple static SVG
>> rendering in Internet Explorer using VML, which is under the terms of
>> MIT license.
>> http://starkravingfinkle.org/blog/2006/03/svg-in-ie/
>>     After a certain number of modifications (symbol and viewbox
>> management, minor corrections), I was able to transform SVG symbols into
>> VML groups. Some problems are still there but most of them are well
>> transformed. So, I inserted the needed functions into Openlayers
>> codebase. For the moment, they are independant functions put into VML.js
>> (one main function and 4 linked functions).
>>     We need to put these functions elsewhere : methods still in VML.js,
>> in Util.js?, or integrate them into a new class and a new file?
>> Since VML shapetype elements can't be as complex as SVG symbol elements,
>> I transformed SVG symbols into VML groups with a visibility put to
>> hidden. The specified group matching the point to draw is then cloned,
>> made visible and put at the right place.
>> So when creating a new vector layer, we can now specify an option with
>> the URL of a single SVG symbols library which will be loaded in the
>> rendererRoot node. Symbols of this library can be used on Firefox
>> (directly in SVG) or on IE (transformed on the fly in Javascript into
>> VML). It slows a little the browser down but loading time is satisfactory.
>> For the moment, we have used this catalogue :
>> http://wiki.openstreetmap.org/index.php/Osmarender/Symbols
>> but people can add their own symbols or symbols from the Open Clip Art
>> library provided that SVG symbols are put inside a <symbol> element with
>> the correct viewBox attribute associated.
>> See :
>> http://dev.openlayers.org/sandbox/camptocamp/vectorSymbols/examples/vector-symbols.html
>> Regards,
>> Barbara
>> Cameron Shorter a écrit :
>>> Barbara,
>>> This sounds like a great initiative and I'd be surprised if there
>>> isn't already a number of projects which transform between SVG and VML.
>>> I know that there has been work converting GML to SVG, and hence there
>>> shouldn't be much work transforming GeoRSS to SVG.
>>> So I suggest:
>>> 1. Before you do any development, research available tools that you
>>> can use.
>>> 2. Create one vector library (either SVG or VML) and use a translation
>>> tool to automatically convert from one to the other.
>>> 3. Precompile the alternative library. Ie, don't convert SVG to VML on
>>> the fly in Javascript. It will slow the browser down.
>>> 3. I suspect that SVG would be a better format to support than VML. I
>>> believe SVG is used by a number of other projects, eg the Linux Icon
>>> libraries.
>>> 4. Search for existing icon libraries and consider extending the
>>> existing icon libraries rather than creating a new project. Maybe make
>>> a geographic version of the library.
>>> 5. Think bigger than just OpenLayers. You start the free icon library
>>> used by all Open Source GIS projects. It might be a candidate project
>>> for: http://wiki.osgeo.org/index.php/OSGeo_Labs
>>> (Although you may want to seed your project within Openlayers)
>>> Barbara Philippot wrote:
>>>> Ian Mayo a écrit :
>>>>> Barbara,
>>>>> I'm afraid I can't offer an opinion on your languages challenge.  It
>>>>> would be great if there was a pre-existing file-format for vector
>>>>> symbols, then we just specify filenames rather than hard-code the
>>>>> vectored shapes.
>>>> Yes, this is why we are trying to do. But people would have to specify
>>>> two filenames (one in SVG, the other in VML) to replace the pre-existing
>>>> symbol catalogue files and it's not still the ideal solution but perhaps
>>>> it's the only one.
>>>>> I'm currenlty working on provision of per-entry icons (images) for
>>>>> georss feeds. [1].  I've made good progress, but may have to pause my
>>>>> efforts for the next 7 days, see my demo at: [2].   Had you considered
>>>>> using the symbols on a per-entry fashion in a georss feed?  I suspect
>>>>> it's fortunate I've got a self-induced development pause: it would
>>>>> seem to be worth offering per-entry symbols as well as icons.
>>>>> Appreciate your thoughts/opinions.
>>>> Well, I hadn't considered using symbols in a georss feed and I don't
>>>> know well Georss format. For the moment, symbols are associated with
>>>> points geometry with a style.use="symbol" in the same way as images were
>>>> associated with style.externalGraphic. So, I haven't looked in detail to
>>>> the way you attach icons to GeoRss nodes but it seems that you would be
>>>> able to use SVG and VML symbols as well as images.
>>>> I hope to make progress before your development pause ends :-)
>>>>> Ian.
>>>>> 1. http://trac.openlayers.org/ticket/1073
>>>>> 2.
>>>>> http://dev.openlayers.org/sandbox/ianmayo/branches/rss/openlayers/examples/georss.html
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/dev
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

Cameron Shorter
Geospatial Systems Architect
Tel: +61 (0)2 8570 5050
Mob: +61 (0)419 142 254

Think Globally, Fix Locally
Commercial Support for Geospatial Open Source Solutions

More information about the Dev mailing list