Geo-referencing content types in Plone with collective.geo

Where is my content?

Who am I?

I'm senior developer and project manager with Abstract since 2011

I have been working with Plone since 2007

During the last years I have gained experience with various Python web development frameworks

Web maps: when, why and how

  1. Complex and specialized GIS application
  2. Maps are the central part of the app
    • Panoramio
    • Foursquare
    • Only-apartments
  3. Geo-referenced CMS

What is collective.geo

collective.geo is a package that allows to geo-reference contents and to display them on a map


In 2008 I faced two problems

What if c.geo was not there

Plone products

  • Products.Maps
  • Products.ATGoogleMaps
  • redturtle.maps.core
  • raptus.article.map

Cons

  1. specific for Archetypes
  2. can only georeference points
  3. can only use Google Maps
  4. developed for a specific project

collective.geo manifesto

Use cases

Use the location field

ENEA

We can use the location field of a content-type to geo-locate the offices of a company

  • Archetypes
  • collective.geo
ENEA webstie

Dexterity content types TTW

Tropical Data Hub

We can assign collective.geo Maps behaviour to a Dexterity content-type in order to make it geo-referenceable

  • Dexterity
  • collective.geo.behaviour
Tropical data hub webstie

Not only points

IW:LEARN

c.geo allows to geo-reference content with different shapes

  • Points
  • Lines
  • Polygons
IW:LEARN webstie

Flexitopic

We can aggregate geo-referenced contents with a Plone collection and, with flexitopic, we can show the results on a table and paginate them

  • collective.flexitopic
  • c.geo.flexitopic
Flexitopic

More customizations

AORIF

The modular structure of collective.geo allows us to customize it in a simple way

On saving a content we can geolocate its address and show it on a map. The user doesn't need to know the coordinates neither to use a complex UI.

Aorif

Backend/frontend

We can use a different javascript map services to display contents.

Ferrara Terra e Acqua

Plone.it - users' map

We can also view the portal users in a specific map

With a portlet we can include the map in a different context such as a landing page.

  • collective.geo.usersmap
plone.it website

Looking for my content

Inside Plone

  • collective.geo.index
External catalogs
  • SOLR
    • collective.solr
  • PostGIS

when an object is geo-referenced an event is fired by collective.geo.geographer

  <subscriber
    handler=".MySubscriber"
    for="IObjectGeoreferencedEvent"
  />
          

collective.geo under the hood

The core of collective.geo

Dependencies

  • Shapely
  • libgeos_c
  • geopy
  • BeautifulSoup

Installation

[buildout]
extends = http://dist.plone.org/release/4.2.1/versions.cfg

eggs =
  collective.geo.bundle
  BeautifulSoup
...
        

Note: Shapely dependency will be removed in the next release

collective.geo structure

c.geo structure

collective.geo.openlayers

Includes the javascript library Openlayers in Plone and some other javascripts that are useful for managing maps in collective.geo

layer = new OpenLayers.Layer.Google(
  'Google maps',
  {
    'sphericalMercator':true,
    numZoomLevels:20
  }
)

collective.geo.geographer

  • based on zgeo.geographer and zgeo.plone.geographer
  • provides the basic mechanism to enter geographic data into georeferenceable contents

any object can be georeferenced


  >>> class Placemark(object):
  ...     implements(
  ...       IGeoreferenceable,
  ...       IAttributeAnnotatable
  ...     )

  >>> placemark = Placemark()

  >>> geo = IGeoreferenced(placemark)
  >>> geo.setGeoInterface('Point',
  ...               (-105.08, 40.59))
          

collective.geo.settings

store default settings for collective.geo

collective.geo.mapwidget

collective.geo.mapwidget

>>> from collective.geo.mapwidget import maplayer
>>> class BingStretMapLayer(maplayer.MapLayer):
...     name = u"bing_map"
...     Title = _(u'Bing Streets')
...     type = 'bing'
...     jsfactory = """
...       function() {
...         return new OpenLayers.Layer.VirtualEarth('%s',
...           {'type': VEMapStyle.Shaded,
...            'sphericalMercator': true});
...       }""" % Title
        

<metal:layer
    use-macro="context/@@collectivegeo-macros/map-widget" />
        

collective.geo.contentlocations

user interface for georeferencing Archetypes content types

  • data can be inserted in WKT format
  • geocoding with geopy
  • it is possible to set customized styles

plone.it website

collective.geo.kml

registers a kml view on the georeferenced objects and on folderish contents such as Folders and Collections.

the KML file can be used on external services like Google Earth/Maps

Dexterity

collective.z3cform.mapwidget
it's a specific widget for z3c.form that allows to manage the geographic data in an easy way
collective.geo.behaviour
it's a Dexterity behaviour that allows to georeference contents and uses the annotations mechanism of collective.geo.geographer for registering data

More extensions

collective.geo.mapcontent

c.geo.mapcontent

collective.geo.file

it provides a view for KML, KMZ (Keyhole Markup Language) and GPX (GPS eXchange Format) files.

The view renders the file in a openlayers Map using the collective.geo library.

Conclusion

Contributors

  • Sean Gillies
  • Silvio Tomatis - silviot
  • Gerhard Weis - gweis
  • David Breitkreutz - rockdj
  • Makina corpus
  • Christian Ledermann - nan
  • David Beitey - davidjb
  • Maurizio Delmonte - miziodel
  • Alice Narduzzo
  • Enrico Barra
Start
Slides
/
Time remaining
Notes

No notes