Posted by barwonhack on November 30, 2010 at 4:18am
Has anyone managed to get the openlayers.js down to less than, say, 300k for use with the openlayers module?
Using the min.conf option with python build script pumps out a respectable 120k .js file ... but it doesn't work at all with Drupal Openlayers.
The library.conf option outputs a .js file "weighing" about 800k. This works with Drupal Openlayers module, but it is hardly worth the effort, saving only about 120kb.
Keen to hear form others re any other experiences in optimising openlayers.js
:) S.

Comments
openlayers_slim is a
openlayers_slim is a middle-ground approach, but basically you'll need to edit the
.cfgfiles to add things you need and remove things you don't - there's probably not a version that's perfect for your needs, but it's very easy to mix & match components. The OpenLayers module's behaviors will notify you whether the behavior is available in your library before you activate it.Great - but Cloudmade and Google support
Thanks - a pretty a pretty good outcome file size wise.
Not rendering Cloudmade or Google Maps and I am struggling to see how to enable that.
Should I create a new Projection within Openlayers (where to do that?) or ...?
Google support you'll need to
Google support you'll need to add, by adding the layer type (something like Layers/Google.js) in the .cfg, and rebuild. Cloudmade you need to download & point your install to the .js in the OpenLayers UI.
Thank a lot @tmcw the slim
Thank a lot @tmcw the slim version worked nice for me for Cloudmade. I only added popup.js, because I needed these and excluded some controls. There used to be a nice page to customize the openlayer script, but I cannot find it anymore. You could select all different options and it generated your customized version. Anyway yours works fine for me.
You're probably thinking of
You're probably thinking of OpenLayerer, which lets you customize OpenLayers piece-by-piece. It's a little buggy because of the underlying OpenLayers code and I haven't had much time to maintain it, but you can give it a shot.
Great that was what I meant.
Great that was what I meant. Really like it as I need different kind of scripts and it is a nice overview.