Friday, February 9th, 2007
GPlotter 0.9: Prototype and Google Maps v2 update
Brennan Stehling has updated his GPlotter project “to make use of the revised Google Maps API. I also completely restructured the Javascript to a much more object oriented coding style. I am using the latest release of Prototype, which recently moved to a new location as well as posted a great deal of new documentation. I am using Prototype for the object inheritance and AJAX functionality.”
GPlotter Example
- var plotter = new GPlotter();
- plotter.setColor(plotter.BLUE);
- plotter.setIconUrl("http://gplotter.offwhite.net/maps/icons/");
- plotter.plot("map", "labels", "milwaukee.xml?version=0.9.0");
Extending GPlotter
- var MyMapper = Class.create();
- Object.extend(MyMapper.prototype, GPlotter.prototype);
- var mapper = new MyMapper();
- mapper.plot("map", "labels", "milwaukee.xml");





Seems a shame to have a dependency to a (relatively) big library like Prototype to do this. Good stuff though.
I’ve looked at the code and tinkered with it for a few minutes. I don’t believe it would be much work at all to use a minimal configuration of Mootools for underlying class support. That could reduce its library dependency to 14k.
Prototype does not provide object orientedness or object inheritance, it provides class inheritance emulation. JavaScript is already object-oriented, it is just that most people learned and are more familiar with class-based object oriented programming rather than prototypical object oriented programming. I believe prototypical is actually purer “object-oriented”.
Jeffrey, Prototype is 15k when gzipped. Size is a non-issue. Please stop spreading this FUD.
We used this same approach last year only used explicit XML data islands and didn’t require any inline javascript. We think it is much cleaner. See http://www.slippymap.com for a sample site. Today we have our own map tiles but will have integrated OpenLayers and will soon relaunch so you can do this with Google maps, Virtual Earth, Yahoo Maps or our own tiles. We think our approach makes mashups as easy as HTML programming (no javascript required).
i think Prototype is not as much object oriented as Jquery.
but, i personally like both of them for different things.
Gplotter is gr8 though it needs a few improvements and developements
Is it possible to use GPlotter with the jquery framework, instead of prototype? I would like to see it work if possible