[177a560] | 1 | |
---|
| 2 | Current for 6.x-2.0-alpha3 |
---|
| 3 | |
---|
| 4 | Obviously there are many points at which advanced users will want to push the |
---|
| 5 | limits of what the OpenLayers module can do. In many cases, these changes can be |
---|
| 6 | make without any 'hacks' to the module, and before hacking, it is highly |
---|
| 7 | recommended to think about ways that changes could be incorporated into the |
---|
| 8 | module proper via patches. |
---|
| 9 | |
---|
| 10 | # Performance |
---|
| 11 | |
---|
| 12 | The largest performance hit of OpenLayers at the moment seems to be in the very |
---|
| 13 | large size of the OpenLayers.js library. The real route to fixing this problem |
---|
| 14 | is by narrowing down the set of components included in the Javascript file. In |
---|
| 15 | order to do this: |
---|
| 16 | |
---|
| 17 | ## Manually |
---|
| 18 | |
---|
| 19 | svn checkout http://svn.openlayers.org/trunk/openlayers/ cd openlayers/build |
---|
| 20 | |
---|
| 21 | edit full.cfg or lite.cfg to include the components your map uses. |
---|
| 22 | |
---|
| 23 | python build.py [yourcustomized.cfg] |
---|
| 24 | |
---|
| 25 | This will produce a compacted, slimmed OpenLayers.js file. |
---|
| 26 | |
---|
| 27 | After doing this, make sure to set the ImgPath and ThemePath in the OpenLayers |
---|
| 28 | administration - these are per-preset settings. The OpenLayers library guesses |
---|
| 29 | the location of its style.css and images, so if you make a compacted |
---|
| 30 | OpenLayers.js in an otherwise empty folder, it will fail in this task and have |
---|
| 31 | blank images and a nonfunctional ZoomBox control (the red 'zooming box') will |
---|
| 32 | not appear. |
---|
| 33 | |
---|
| 34 | ## Map Performance |
---|
| 35 | |
---|
| 36 | Using multiple domain names for layers will [dodge the browser connection |
---|
| 37 | limit](http://trac.openlayers.org/wiki/OpenLayersOptimization) and allow more |
---|
| 38 | tiles to load in parallel. However, this has a bad interaction with the default |
---|
| 39 | buffer setting, making tiles outside the viewport load first in many cases, so |
---|
| 40 | buffer should be set to 0 if multiple urls are enabled. |
---|
| 41 | |
---|
| 42 | # Custom Behaviors |
---|
| 43 | |
---|
| 44 | If behaviors similar to those included are necessary, just clone the behaviors |
---|
| 45 | and create a tiny new module that includes the copy. The same goes for layers, |
---|
| 46 | etc. |
---|