Hello,
In the last French meeting I say that I say that I will seek about OpenLayers optimization (Download size ans parse time, but not execution speed) :
Than to do that the goal is to have one js file with only what we need, it mean that we include only OpenLayers files that we need, we remove comments and unneeded spaces.
To do that first we need the Openlayers sources: Version 2.10: svn export http://svn.openlayers.org/branches/openlayers/2.10/ openlayers Version 2.11 RC: svn checkout http://svn.openlayers.org/branches/openlayers/2.11/ openlayers Version trunk: svn checkout http://svn.openlayers.org/trunk/openlayers/ openlayers
Go to the build directory: cd openlayers/build Create own profile: cp lite.cfg my.cfg edit my.cfg to replace 'OpenLayers/Layer/XYZ.js' by yours needed files (one per line), the dependencies will be check.
Than build it: python build.py -c jsmin my.cfg OpenLayers-my.js
The result is that to display an OSM layer we have a file size of only 121ko in place of about 1Mo for a full version of OpenLayers.
CU and happy development ;-) Stéphane Brunner
Hello,
I made a little mistake, to have a minimal OSM map we need a builf file like it: [first]
[last]
[include] OpenLayers/Map.js OpenLayers/Control/ArgParser.js OpenLayers/Control/Attribution.js OpenLayers/Control/Navigation.js OpenLayers/Control/PanZoom.js OpenLayers/Layer/XYZ.js
[exclude]
Than we have a file less than 160ko
CU Stéphane
On Sat, Jul 9, 2011 at 2:22 PM, Stéphane Brunner courriel@stephane-brunner.ch wrote:
Hello,
In the last French meeting I say that I say that I will seek about OpenLayers optimization (Download size ans parse time, but not execution speed) :
Than to do that the goal is to have one js file with only what we need, it mean that we include only OpenLayers files that we need, we remove comments and unneeded spaces.
To do that first we need the Openlayers sources: Version 2.10: svn export http://svn.openlayers.org/branches/openlayers/2.10/ openlayers Version 2.11 RC: svn checkout http://svn.openlayers.org/branches/openlayers/2.11/ openlayers Version trunk: svn checkout http://svn.openlayers.org/trunk/openlayers/ openlayers
Go to the build directory: cd openlayers/build Create own profile: cp lite.cfg my.cfg edit my.cfg to replace 'OpenLayers/Layer/XYZ.js' by yours needed files (one per line), the dependencies will be check.
Than build it: python build.py -c jsmin my.cfg OpenLayers-my.js
The result is that to display an OSM layer we have a file size of only 121ko in place of about 1Mo for a full version of OpenLayers.
CU and happy development ;-) Stéphane Brunner
-- Envoyé depuis mon lapin -- Catalogue de cartes OpenStreetMap - http://map.stephane-brunner.ch Un peu d'espace qui vous suis partout - https://www.getdropbox.com/referrals/NTk2OTU2Mjk --