Please note that the upgrade path will not be stable until the OpenLayers 2.x branch is stable, and this page will probably not be 100% accurate until that time as well. BACKUP before upgrading!
These instructions are for users upgrading their OpenLayers modules from 1.x (1.0) to the newer 2.x (2.0) versions. The 2.x version of the module is much more powerful and will have longer term support and development for it. Upgrading from 0.x (0.1-alpha) is a different process than this.
- Please, for your piece of mind, backup your database and your code before doing any upgrades. If something goes wrong, you will be very disappointed if you had not backed-up.
- Ensure that you have newest 1.x version and have run all the updates. This is necessary so that the 2.x version knows you are upgrading from the 1.x version.
- Put your site into offline/maintenance mode.
- Disable OpenLayers Preset UI module. This module is renamed in the 2.x version.
Note that the automatic part of the upgrade will only encompass the data that is contained in the database, specifically the presets. This means that any objects (such as layers, styles, presets, etc.) that you may have put in a custom module will not be upgraded; these will need to be manually upgraded.
The following is the normal upgrade mechanism for Drupal. This handles the automatic part of the upgrade. Note that only objects in the database can be automatically upgraded; meaning that if you have objects in code, they will not be upgraded.
- Remove any 1.x code.
- Download the 2.x code.
- Go to update.php and run database updates.
There are still some steps that need to be taken to ensure that everything is working correctly.
It is suggested that you look over your map presets to ensure that all the settings are correct. Some properties, layers, etc. are automatically
- OpenLayers WKT Map widget:
- The settings of the field/widget are not transferred, so you will have to set these back up.
- The format of the WKT is different in the 2.x module. The main thing is that in the 2.x version, everything is in a
GEOMETRYCOLLECTION(). For instance:
MULTIPOINT((3.5 5.6),(4.8 10.5))becomes
GEOMETRYCOLLECTION(POINT(3.5 5.6),POINT(4.8 10.5))
- This change in the WKT format is not addressed to ensure that the behavior of the fields will remain the same, and OpenLayers can handle either format without any problem. You do not need to update the data.
- Support for the Geo module has been removed, if you were using Openlayers to provide widgets for Geo fields you will need to find an alternative.
Due to structural changes in how we use views in 2.x, there is no way to provide an automatic upgrade for your OpenLayers views. You may end up with Views that use the OpenLayers style, but they will not have data in them, nor will they have the same behaviors.
You should rebuild all your OpenLayers Views. Please read the 2.x tutorial on Views that explains how this new structure works. The biggest concept change is that there is a separate between providing data Views to maps and displaying maps with Views.
There are some large architectural changes in 2.x and thus some significant API changes. Please see the 2.x documentation for how the new data structures and objects work.
BECAME openlayers_include(): openlayers_initialize()
openlayers_render_map($map = array(), $render = TRUE)
openlayers_layers_get_info($reset = FALSE)
openlayers_behaviors_get_info($reset = FALSE)
openlayers_styles_get_info($reset = FALSE)
BECAME openlayers_preset_save($preset = array()): openlayers_save_preset($preset = array())
openlayers_get_preset($name = '', $reset = FALSE)
openlayers_get_map($id = '')
openlayers_presets($reset = FALSE)
openlayers_get_presets($format = 'simple', $reset = FALSE)
openlayers_get_default_map($reset = FALSE)
REMOVED: openlayers_merge_maps($map1 = array(), $map2 = array())
openlayers_error_check_map($map, $log_errors = TRUE)
theme_openlayers_map($map = array())=> (remains same)
theme_openlayers_vector_styles($styles = array(), $map = array())=>
theme_openlayers_styles($styles = array(), $map = array())
theme_openlayers_behaviors_tooltip_container($behavior = array(), $map = array())=> ??
theme_openlayers_presets_ui_form_layer_description($layer_title = '', $layer_description = '')=> (remains same)
theme_openlayers_presets_ui_form_projection_description($projection_title = '', $available_layers = array(), $layers = array())=> (remains same)
theme_openlayers_views_feature_style($view = NULL, $row = NULL, $group = NULL)=> ??
Instead of living under Site Configuration (
admin/settings), the OpenLayers menu items are now under Site Building (
Any bug reports and support requests should be reported in the OpenLayers issue queue.