You are here

CUSTOMIZATION.txt in Openlayers 6.2

Same filename and directory in other branches
  1. 7.2 docs/CUSTOMIZATION.txt
Current for 6.x-2.0-alpha3

Obviously there are many points at which advanced users will want to push the
limits of what the OpenLayers module can do. In many cases, these changes can be
make without any 'hacks' to the module, and before hacking, it is highly
recommended to think about ways that changes could be incorporated into the
module proper via patches.

# Performance

The largest performance hit of OpenLayers at the moment seems to be in the very
large size of the OpenLayers.js library. The real route to fixing this problem
is by narrowing down the set of components included in the Javascript file. In
order to do this:

## Manually

    svn checkout http://svn.openlayers.org/trunk/openlayers/ cd openlayers/build

edit full.cfg or lite.cfg to include the components your map uses.

    python build.py [yourcustomized.cfg]

This will produce a compacted, slimmed OpenLayers.js file.

After doing this, make sure to set the ImgPath and ThemePath in the OpenLayers
administration - these are per-preset settings. The OpenLayers library guesses
the location of its style.css and images, so if you make a compacted
OpenLayers.js in an otherwise empty folder, it will fail in this task and have
blank images and a nonfunctional ZoomBox control (the red 'zooming box') will
not appear.

## Map Performance

Using multiple domain names for layers will [dodge the browser connection
limit](http://trac.openlayers.org/wiki/OpenLayersOptimization) and allow more
tiles to load in parallel. However, this has a bad interaction with the default
buffer setting, making tiles outside the viewport load first in many cases, so
buffer should be set to 0 if multiple urls are enabled.

# Custom Behaviors

If behaviors similar to those included are necessary, just clone the behaviors
and create a tiny new module that includes the copy. The same goes for layers,
etc.

File

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