[OpenLayers-Dev] Hello and a SVG Format patch

Jonathan Lister jon at osmosoft.com
Mon Nov 3 12:37:58 EST 2008


Tim,

Thanks for your response! I agree that the size and placement of the
SVG in a layer should be independent of the size of the map, so I've
made those parameters.

I followed the rest of your instructions to turn my work into a
contribution and have created this patch:
http://trac.openlayers.org/ticket/1808

Please let me know what you think.



J.

------------------------

Hey-

Jonathan Lister wrote:
> Hello! (sorry if this is the second time you get this... had sending problems)
>
> My name is Jonthan Lister, I've just got into OpenLayers and I'm very
> excited by what I can do with it! I'd like to say a big thank you to
> everyone who is contributing to the project - thanks!
>
> I've spent a few days putting together a new feature to allow me to
> read in SVG files and use them as layers. I've posted the code on
> pastebin:
> http://pastebin.com/m6b718a2
>
> This adds OpenLayers.Format.SVG to the existing formats, so you can do
> something like this:
>
> var svg = new OpenLayers.Layer.GML('SVG','mySVG.svg', {
> format:OpenLayers.Format.SVG });
>
> I would really appreciate some feedback on this idea. There are a
> number of notes in the comments at the start of the file that go into
> some more detail about my thinking about this.
>

Thanks for the work on this.  I think it would make a nice contribution.

A couple questions/suggestions:

It doesn't seem to me like parsing svg should depend on the size of the
map viewport.  I would prefer to see properties on the format that let a
user specify any scaling and offset in order to transform svg coords
into map coords.  Is there a reason this couldn't be done?

Please read up on how to contribute to the library [1].  Including links
to creating patches [2] and coding style [3].  Also, before creating a
patch and attaching it to a ticket, you should take a shot at test
writing [4].

Finally, it looks like this is inspired by the old GML parser.  I have
started using a different style for parsing XML that I find more
maintainable and flexible.  Check out the new GML parsers if you haven't
already [5].  If the style doesn't make sense, I'm happy to rework the
format later.

Tim

[1] http://trac.openlayers.org/wiki/HowToContribute
[2] http://trac.openlayers.org/wiki/CreatingPatches
[3] http://trac.openlayers.org/wiki/CodingStandards
[4] http://trac.openlayers.org/wiki/WritingUnitTests
[5]
http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Format/GML/Base.js

--
http://www.jaybyjayfresh.com



More information about the Dev mailing list