31
Geo-referencing content types in Plone with collective.geo Where is my content?

Where is my content?

Embed Size (px)

DESCRIPTION

Geo-referencing content types in Plone with collective.geo

Citation preview

Page 1: Where is my content?

Geo-referencing content types in Plone withcollective.geo

Where is mycontent?

Page 2: Where is my content?

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

I have been working with Plone since 2007I have been working with Plone since 2007

During the last years I have gained experience with various Python webDuring the last years I have gained experience with various Python webdevelopment frameworksdevelopment frameworks

Where is my content? — Giorgio Borelli Abstract

Page 3: Where is my content?

Web maps: when, why and how

Complex and specialized GIS application1.Maps are the central part of the app

PanoramioFoursquareOnly-apartments

2.

Geo-referenced CMS3.

Where is my content? — Giorgio Borelli Abstract

Page 4: Where is my content?

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

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

In 2008 I faced two problems

learning Plone 3 and the Zope component architectureput a lot of contents on a map

Where is my content? — Giorgio Borelli Abstract

Page 5: Where is my content?

What if c.geo was not therePlone products

Products.MapsProducts.ATGoogleMapsredturtle.maps.coreraptus.article.map

Consspecific for Archetypes1.can only georeference points2.can only use Google Maps3.developed for a specific project4.

Where is my content? — Giorgio Borelli Abstract

Page 6: Where is my content?

collective.geo manifestomodular and easily extendableup to date and taking advantage of ZCAnot related to a specific map service

Where is my content? — Giorgio Borelli Abstract

Page 7: Where is my content?

Use cases

Page 8: Where is my content?

ENEAWe can use the location fieldof a content-type togeo-locate the offices of acompany

Archetypescollective.geo

http://www.enea.it

Use the location field

Where is my content? — Giorgio Borelli Abstract

Page 9: Where is my content?

Tropical Data HubWe can assign collective.geoMaps behaviour to aDexterity content-type inorder to make itgeo-referenceable

Dexteritycollective.geo.behaviour

http://tropicaldatahub.org/

Dexterity content types TTW

Where is my content? — Giorgio Borelli Abstract

Page 10: Where is my content?

IW:LEARNc.geo allows to geo-referencecontent with different shapes

PointsLinesPolygons

http://iwlearn.net/

Not only points

Where is my content? — Giorgio Borelli Abstract

Page 11: Where is my content?

We can aggregategeo-referenced contents witha Plone collection and, withflexitopic, we can show theresults on a table andpaginate them

collective.flexitopicc.geo.flexitopic

Flexitopic

Where is my content? — Giorgio Borelli Abstract

Page 12: Where is my content?

AORIFThe modular structure ofcollective.geo allows us tocustomize it in a simple way

On saving a content we cangeolocate its address and showit on a map. The user doesn'tneed to know the coordinatesneither to use a complex UI.

More customizations

Where is my content? — Giorgio Borelli Abstract

Page 13: Where is my content?

We can use a different javascriptmap services to display contents.

Google mapsPolymaps http://polymaps.org/

Leaflethttp://leaflet.cloudmade.com

Kartographhttp://kartograph.org

http://ferraraterraeacqua.it/

Backend/frontend

Where is my content? — Giorgio Borelli Abstract

Page 14: Where is my content?

We can also view the portalusers in a specific map

With a portlet we can include themap in a different context suchas a landing page.

collective.geo.usersmap

http://plone.it/partecipa

Plone.it - users' map

Where is my content? — Giorgio Borelli Abstract

Page 15: Where is my content?

Inside Plonecollective.geo.index

External catalogsSOLR

collective.solr

PostGIS

when an object is geo-referenced anevent is fired bycollective.geo.geographer

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

Looking for my content

Where is my content? — Giorgio Borelli Abstract

Page 16: Where is my content?

collective.geo underthe hood

Page 17: Where is my content?

DependenciesShapelylibgeos_cgeopyBeautifulSoup

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

eggs = collective.geo.bundle BeautifulSoup...

The core of collective.geo

Note: Shapely dependency will be removed in the next release

Where is my content? — Giorgio Borelli Abstract

Page 18: Where is my content?

collective.geo structure

Where is my content? — Giorgio Borelli Abstract

Page 19: Where is my content?

collective.geo.openlayersIncludes the javascript library Openlayers in Plone and some otherjavascripts that are useful for managing maps in collective.geo

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

Where is my content? — Giorgio Borelli Abstract

Page 20: Where is my content?

based on zgeo.geographer andzgeo.plone.geographerprovides the basic mechanism toenter geographic data intogeoreferenceable 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.geographer

Where is my content? — Giorgio Borelli Abstract

Page 21: Where is my content?

collective.geo.settingsstore default settings for collective.geo

map centerzoom levelwhich layers have to be shown on the mapwhich contents can be georeferenceddefault styles for all features

Where is my content? — Giorgio Borelli Abstract

Page 22: Where is my content?

collective.geo.mapwidgetmanages the mechanism that handles Openlayers maps in Ploneeach map widget is a Zope component which contains a series oflayersall the maps in collective.geo are composed by one or more maplayers and each layer returns a javascript snippet by a page templatewhich contains all information about the layer itself

Where is my content? — Giorgio Borelli Abstract

Page 23: Where is my content?

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" />

Page 24: Where is my content?

data can be inserted in WKTformatgeocoding with geopyit is possible to setcustomized styles

collective.geo.contentlocationsuser interface for georeferencing Archetypes content types

Where is my content? — Giorgio Borelli Abstract

Page 25: Where is my content?

collective.geo.kmlregisters a kml view on the georeferenced objects and on folderishcontents such as Folders and Collections.

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

Where is my content? — Giorgio Borelli Abstract

Page 26: Where is my content?

Dexteritycollective.z3cform.mapwidget

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

collective.geo.behaviourit's a Dexterity behaviour that allows to georeference contents anduses the annotations mechanism of collective.geo.geographer forregistering data

Where is my content? — Giorgio Borelli Abstract

Page 27: Where is my content?

More extensions

Page 28: Where is my content?

collective.geo.mapcontent

Where is my content? — Giorgio Borelli Abstract

Page 29: Where is my content?

collective.geo.fileit 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.geolibrary.

Where is my content? — Giorgio Borelli Abstract

Page 30: Where is my content?

Conclusion7 packages on the core (two more for Dexterity soon)9 addons packagestranslated in 9 languagesCoactivate http://www.coactivate.org/projects/collectivegeoReadthedocs http://collectivegeo.readthedocs.org

Where is my content? — Giorgio Borelli Abstract

Page 31: Where is my content?

Sean GilliesSilvio Tomatis - silviotGerhard Weis - gweisDavid Breitkreutz - rockdjMakina corpus

Christian Ledermann - nanDavid Beitey - davidjbMaurizio Delmonte - miziodelAlice NarduzzoEnrico Barra

Contributors

Where is my content? — Giorgio Borelli Abstract