collective.geo.openlayers

openlayers support for Plone

Project Description

collective.geo.openlayers

Introduction

collective.geo.openlayers enables Openlayers machinery into Plone.

This package registers two javascript files into Plone javascript registry:

  1. OpenLayers.js
  2. proj4js-compressed.js
https://secure.travis-ci.org/collective/collective.geo.openlayers.png

Found a bug? Please, use the issue tracker.

Installation

This addon can be installed has any other addons, please follow official documentation.

Upgrading

Version 3.0

If you are upgrading from an older version to 3.0, you may need to run upgrade steps. To do this, follow these steps:

  1. Browse to portal_setup in the ZMI of your site
  2. Click onto the Upgrades tab
  3. Select collective.geo.openlayers:default from the drop-down list and click Choose Profile
  4. Observe any available upgrades and click the Upgrade button if any are present.

Integration example

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 fill-slot="top_slot"
          tal:define="dummy python:request.set('disable_border',1);
                      portal_state context/@@plone_portal_state;
                      portal_url portal_state/portal_url" />
    <metal:block metal:fill-slot="javascript_head_slot">
      <!-- optional openlayers translation -->
      <script type="text/javascript"
          tal:attributes="src string:$portal_url/lang/de.js"></script>
      <script type="text/javascript">
          OpenLayers.Lang.setCode('de');
      </script>

      <script type="text/javascript">
          jq(window).bind('load', function() {
             map = new OpenLayers.Map( 'map');
             layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
             map.addLayer(layer);
             map.setCenter(
                new OpenLayers.LonLat(-71.147, 42.472).transform(
                    new OpenLayers.Projection("EPSG:4326"),
                    map.getProjectionObject()
                ), 12
             );
          });
      </script>
    </metal:block>
  </head>

  <body>
   <metal:content-core fill-slot="content-core">
     <metal:content-core define-macro="content-core">
        <div id="map" class="olMap" style="width:100%;height: 500px;">
            <!-- openlayers map -->
        </div>

     </metal:content-core>
   </metal:content-core>
  </body>
</html>

Updating this package

When a new version of OpenLayers is released, this package can be updated accordingly using the following steps, keeping in mind that some paths and URLs will need adjustment:

cd ~/collective.geo.openlayers
cd collective/geo/openlayers/skins/
#Change URL accordingly
wget http://openlayers.org/download/OpenLayers-<STABLE VERSION>.tar.gz
tar xf OpenLayers*.tar.gz
mv OpenLayers-<STABLE VERSION> OpenLayers
#Maintain 3rd party files
mv geo_openlayers/plone3_fix_form_tabbing.js geo_openlayers/proj4js-compressed.js .
git rm geo_openlayers/* -r
mkdir geo_openlayers
#Only select the files we need
mv OpenLayers/{*.js,*.txt,*.md,img,theme} geo_openlayers/
mv *.js geo_openlayers/
git add geo_openlayers/
#Copy the translation files
mv OpenLayers/lib/OpenLayers/Lang/*.js geo_openlayers/lang/

#Edit change note now in history
vim ~/collective.geo.openlayers/docs/HISTORY.txt
git commit -a -m "Updated to OpenLayers [version]"

Contributors

  • Giorgio Borelli - gborelli
  • Silvio Tomatis - silviot
  • David Beitey - davidjb
  • Gerhard Weis - gweis
  • Denis Krienbühl - href

Changelog

3.1 (2014-02-26)

  • Updated OpenLayers to 2.13.1 [gborelli]
  • Add style for IGeoFeatureStyle behavior [gborelli]

3.0 (2013-10-29)

  • changed package layout [gborelli]
  • added javascripts in portal_javascript registry [gborelli]

2.5 (2013-01-28)

  • added travis-ci configurations [gborelli]
  • moved openlayers_test.pt template to tests directory [gborelli]
  • refactored tests in order to use plone.app.testing and unittest2 [gborelli]
  • Updated OpenLayers to version 2.12. deprecated.js is available in this package for deprecated elements as per https://github.com/openlayers/openlayers/blob/master/notes/2.12.md#deprecated-components [davidjb]
  • Encourage OpenLayers to shorten popup widths via CSS. Long marker headings (eg content titles) would cause popups to fill the map. [davidjb]
  • Added OpenLayers language files [href]

0.2.4 (2012-01-21)

  • Updated Openlayers to 2.11 version

0.2.3 (2011-09-05)

  • added integration example in readme file [gborelli]
  • plone 4.1 fixes [gborelli]
  • changed Browser import from Testing.testbrowser [gborelli]
  • added z3c.autoinclude entry point [gborelli]

0.2.2 (2010-12-28)

  • fixed css registry entries [gborelli]

0.2.1 (2010-11-13)

  • Updated Openlayers to 2.10 version

0.2 (2010-10-31)

  • renamed cgeo-openlayers css and included in css registry [gborelli]
  • removed openlayers-macros [gborelli]
  • Added CSS for definition lists within the framed cloud popups, as used in collective.geo.kml [rockdj]
  • Added ZCML registration for all skin subdirectories. Without this, elements like the Edit toolbar don't appear when Plone isn't running in debug mode. [rockdj]
  • Updated OpenLayers.js to 2.8 (+styles and resources)
  • Register all browser pages and resources for IOpenLayers browser layer
  • Removed geo-point.js in favour of editing features provided by OpenLayers
  • Updated coordinate reference order to be consistent with WGS 1984 reference system. This involves standardising the coordinate order to be [longitude, latitude] rather than [latitude, longitude]. [rockdj]
  • Gave the Map element a relative position via CSS to allow Plone drop-down menus to appear over the top (z-index doesn't apply unless position is specified). [rockdj]
  • Added ZCML registration for 'img' and 'theme' skin subdirectories. Without registration, these folders are unable to be seen in Plone and the OpenLayers controls don't appear. [rockdj]
  • Added unit tests to ensure skin subdirectory registration works. [rockdj]

0.1 (2009-06-19)

  • Initial release

Self-Certification

[X] Internationalized

[X] Unit tests

[ ] End-user documentation

[ ] Internal documentation (documentation, interfaces, etc.)

[ ] Existed and maintained for at least 6 months

[ ] Installs and uninstalls cleanly

[ ] Code structure follows best practice

Current Release
collective.geo.openlayers 3.1

Released Feb 26, 2014 — tested with Plone 4.3, Plone 4.2

Updated OpenLayers to 2.13.1
More about this release…

Download file Get collective.geo.openlayers for all platforms
collective.geo.openlayers-3.1.zip
If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.

All Releases

Version Released Description Compatibility Licenses Status
3.1 Feb 26, 2014 Updated OpenLayers to 2.13.1 More about this release…
Plone 4.3
Plone 4.2
GPL final
3.0 Oct 29, 2013 javascript and css in portal registry More about this release…
Plone 4.3
Plone 4.2
Plone 4.1
Plone 4
Plone 3
GPL final
2.5 Jan 28, 2013 Updated OpenLayers to version 2.12 More about this release…
Plone 4.2
Plone 4.1
Plone 4
Plone 3
GPL final
0.2.4 Jan 21, 2012 updated Openlayers to 2.11 to improve mobile devices support More about this release…
Plone 4.2
Plone 4.1
Plone 4
GPL final
0.2.3 Sep 05, 2011 bug fixes and plone 4.1 compatibility More about this release…
Plone 4.1
Plone 4
GPL final
0.2.2 Dec 28, 2010 minor fixes More about this release…
Plone 4
Plone 3
GPL final
0.2.1 Nov 13, 2010 Updated Openlayers to 2.10 version More about this release…
Plone 4
Plone 3
GPL final
0.2 Update to Plone 4 More about this release…
Plone 4
Plone 3
GPL beta