collective.geo.openlayers enables Openlayers machinery into Plone.
This package registers two javascript files into Plone javascript registry:
- OpenLayers.js
- proj4js-compressed.js
Found a bug? Please, use the issue tracker.
Table of contents
- Plone >= 5.0
for previous Plone versions use collective.geo.openlayers < 4.x
This addon can be installed has any other addons, please follow official documentation.
If you are upgrading from an older version to 3.0, you may need to run upgrade steps. To do this, follow these steps:
- Browse to
portal_setup
in the ZMI of your site - Click onto the
Upgrades
tab - Select
collective.geo.openlayers:default
from the drop-down list and clickChoose Profile
- Observe any available upgrades and click the
Upgrade
button if any are present.
You can include openlayers in a Plone browser page in this way (for further information about openlayers see other openlayers examples):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
metal:use-macro="here/main_template/macros/master">
<head>
<metal:block metal:fill-slot="javascript_head_slot">
<script type="text/javascript">
<!--
(function ($) {
var map;
$(window).load(function() {
map = new OpenLayers.Map('map',{
theme: null
});
map.addLayer(new OpenLayers.Layer.OSM("OpenStreetMap"));
map.setCenter(new OpenLayers.LonLat(7, 45).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 5);
});
}(jQuery));
// -->
</script>
</metal:block>
</head>
<body>
<metal:content fill-slot="content-core">
<metal:content define-macro="content-core">
<div id="map" class="olMap widget-cgmap">
<!-- openlayers map -->
</div>
</metal:content>
</metal:content>
</body>
</html>
When a new version of OpenLayers is released, the javascript on this package can be updated by using the Makefile in the root directory. Commands available:
- build - it builds a new version of OpenLayer javascript.
- copysrc - it copies all necessary files in plone resources directory.
- dist - it is the default command, it executes all previous commands.
See the complete list of contributors on Github: