managing georeferenced content with Plone and collective.geo

28
managing georeferenced content with Plone collective.geo Giorgio Borelli

description

 

Transcript of managing georeferenced content with Plone and collective.geo

Page 1: managing georeferenced content with Plone and collective.geo

managing georeferenced content with Plonecollective.geo

Giorgio Borelli

Page 2: managing georeferenced content with Plone and collective.geo

What is collective.geo?

collective.geo is a package bundle for Plone that allows to georeference contents and to display them on a map

http://plone.org/products/collective.geo

what is collective.geo?

Page 3: managing georeferenced content with Plone and collective.geo

Existing solutions for Plone?

• Products.Maps

• Products.ATGoogleMaps

• raptus.article.maps

• they are specific for Archetypes

• they can only georeference points

• they can only use Google Maps

• it is developed for a specific project (Raptus Article)

what is collective.geo?

Page 4: managing georeferenced content with Plone and collective.geo

I need a new product• that takes advantage of ZCA

• that is Plone3/4 specific

• that takes advantage of other projects that are developed by people that know GIS well

• that is modular, so that some of its parts could be used separately

• that gives the possibility to use maps that are not Google

• that can be easily extended in the future

what is collective.geo?

Page 5: managing georeferenced content with Plone and collective.geo

2009 the first releasecollective.geo - step 1

• it provides a simple user interface to zgeo packages (from the gispython project)

1. zgeo.geographer (zgeo.plone.geographer)

2. zgeo.kml (zgeo.plone.kml)

• it uses openlayers (Google, Yahoo, Bing, Openstreetmap)

what is collective.geo?

Page 6: managing georeferenced content with Plone and collective.geo

collective.geo step 2

• code refactoring

• project on coactivate

http://www.coactivate.org/projects/collectivegeo

• more contributors (rockdj, gweis)

• a nice logo

first stable release

what is collective.geo?

Page 7: managing georeferenced content with Plone and collective.geo

collective.geo packages

Page 8: managing georeferenced content with Plone and collective.geo

Installation

• Shapely >= 1.0.14

• libgeos_c >= 3.1

• geopy

• BeautifulSoup

collective.geo.bundle

[buildout]...

extends= http://good-py.appspot.com/release/plone.app.z3cform/0.5.3?plone=4.0.5...

eggs= collective.geo.bundle BeautifulSoup...

collective.geo packages

Page 9: managing georeferenced content with Plone and collective.geo

c.geo.contentlocations

c.geo.openlayers c.geo.geographer

c.geo.settings

c.geo.mapwidget

c.geo.kml

Internal dependencies

collective.geo packages

Page 10: managing georeferenced content with Plone and collective.geo

collective.geo.openlayers

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

collective.geo packages

Page 11: managing georeferenced content with Plone and collective.geo

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 if it implements IGeoreferenceable and IAttributeAnnotatable

collective.geo packages

Page 12: managing georeferenced content with Plone and collective.geo

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

>>> placemark = Placemark()

>>> from collective.geo.geographer.interfaces import IGeoreferenced>>> geo = IGeoreferenced(placemark)

Now set the location geometry to type "Point" and coordinates 105.08 degrees West, 40.59 degrees North

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

A georeferenced object has "type" and "coordinates" attributes which should return the correct coordinates

>>> geo.type'Point'>>> geo.coordinates(-105.08, 40.59)

Example

collective.geo packages

Page 13: managing georeferenced content with Plone and collective.geo

collective.geo.settings• based on plone.app.registry

• store default settings for collective.geo

• map center

• zoom level

• which layers have to be shown on the map

• which contents can be georeferenced

• default styles for all features

collective.geo packages

Page 14: managing georeferenced content with Plone and collective.geo

collective.geo packages

collective.geo.settings

Page 15: managing georeferenced content with Plone and collective.geo

collective.geo.mapwidget

• manages the mechanism that handles Openlayers maps in Plone

• each map widget is a Zope component which contains a series of layers

• each map layer is an Openlayers layer and a series of page templates that take care of registering some Metal macro in order to include maps into pages.

collective.geo packages

Page 16: managing georeferenced content with Plone and collective.geo

collective.geo.mapwidget

map widget

map layers

collective.geo packages

Page 17: managing georeferenced content with Plone and collective.geo

collective.geo.mapwidget

>>> from collective.geo.mapwidget.maplayers import MapLayer

>>> class BingStreetMapLayer(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

Example

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

collective.geo packages

Page 18: managing georeferenced content with Plone and collective.geo

collective.geo.contentlocations

• user interface for georeferencing Archetypes content types

• data is inserted in WKT format, then processed by the Shapely library and passed to collective.geo.geographer

• coordinates can also be specified through the Google geocoding service (geopy)

• for each georeferenced object it is possible to set customized styles that will make it different from others.

collective.geo packages

Page 19: managing georeferenced content with Plone and collective.geo

collective.geo.contentlocations

edit toolbar

geocoding

WKT data

collective.geo packages

Page 20: managing georeferenced content with Plone and collective.geo

collective.geo.contentlocationscustom styles

collective.geo packages

Page 21: managing georeferenced content with Plone and collective.geo

collective.geo.kml

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

collective.geo packages

Page 22: managing georeferenced content with Plone and collective.geo

other possibilities

Page 23: managing georeferenced content with Plone and collective.geo

collective.geo.mapcontent - Makina Corpus

other possibilities

http://plone.org/products/collective.geo.mapcontent

Page 24: managing georeferenced content with Plone and collective.geo

collective.geo.flexitopic - Christian Ledermann

http://iwlearn.net/iw-projectsother possibilities

Page 25: managing georeferenced content with Plone and collective.geo

further development

Page 26: managing georeferenced content with Plone and collective.geo

further development

collective.z3cform.mapwidget

a specific widget for z3c.form that allows to manage thegeographic data in a easy way

from z3c.form import field, formfrom collective.z3cform.mapwidget ... import MapWidget

class MyForm(form.Form): fields = field.Fields(IMyInterface)

fields['geodata'].widgetFactory = MapWidget

http://svn.plone.org/svn/collective/collective.z3cform.mapwidget

Page 27: managing georeferenced content with Plone and collective.geo

further development

collective.geo.behaviour

a behaviour for Dexterity that allows to georeference contents and uses the annotations mechanism of collective.geo.geographer for registering data

http://svn.plone.org/svn/collective/collective.geo.behaviour

Page 28: managing georeferenced content with Plone and collective.geo

ContributorsSean Gillies

Silvio Tomatis - silviotGerhard Weis - gweis

 David Breitkreutz - rockdjMakina corpus

Christian Ledermann - nanMaurizio Delmonte - miziodel

Alice NarduzzoEnrico Barra