Add geo views for dexterity content with leaflet js library
Project description
.. contents::
==========================================================================
collective.geo.leaflet
==========================================================================
This package use the collective.geo.* suite with leaflet.
Todo
====
[ ] Get "attribution" map from registry or
[ ] Testing loading map with Robot
[ ] Add uninstall profile
[ ] Translations
[ ] Simple element view should use geojson
[ ] Use leaflet for control panel map
[ ] Use leaflet for configure map
Dependencies
============
- collective.geo.behaviour
- collective.geo.contentlocations
- collective.geo.geographer
- collective.geo.json
- collective.geo.mapwidget
- collective.geo.openlayers
- collective.geo.settings
- collective.js.leaflet
- collective.z3cform.mapwidget
- collective.z3cform.colorpicker
How to add baseLayer
====================
What is a leaflet baseLayer :
http://leafletjs.com/examples/layers-control.html
In Plone, if you want to add a baseLayer, you have to add a subscriber on collective.geo.geographer.interfaces.IGeoreferenced (for exemple, in `configure.zcml`)::
<subscriber
for="collective.geo.geographer.interfaces.IGeoreferenced"
provides="collective.geo.leaflet.interfaces.IMapLayer"
factory=".maplayers.OpenStreetMap
/>
After, create your factory in python (`maplayers.py`)::
from collective.geo.leaflet.maplayers import MapLayer
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class OpenStreetMap(MapLayer):
name = u"osm"
title = _(u"Open Street Map")
index = ViewPageTemplateFile('browser/layers/osm.pt')
And add your javascript into a template file `osm.pt`::
<script type="text/javascript">
var osmAttrib = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
var osmUrl = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png';
var %(name)s = L.tileLayer(osmUrl, {
attribution: osmAttrib,
});
</script>
Tests
=====
This package is tested using Travis CI. The current status is :
.. image:: https://travis-ci.org/collective/collective.geo.leaflet.svg
:target: https://travis-ci.org/collective/collective.geo.leaflet
Contributors
============
- Benoît Suttor, benoit.suttor@imio.be
Changelog
=========
0.1b6 (2015-01-14)
------------------
- Nothing changed yet.
0.1b5 (2015-01-06)
------------------
- Fix name of upgrade step profile.
[bsuttor]
0.1b4 (2015-01-06)
------------------
- Fix one french translation ('recheche' instead of 'recherche').
[bsuttor]
- Use Markercluster plugins (https://github.com/Leaflet/Leaflet.markercluster) with collective.js.leaflet.
[bsuttor]
0.1b3 (2014-08-26)
------------------
- Use a "local" version of leaflet-google.js downloaded from https://gist.github.com/crofty/2197042
[bsuttor]
0.1b2 (2014-08-21)
------------------
- Fix an indentation error.
[bsuttor]
- Add collective_geo_styles indexer for dexterty content.
[bsuttor]
- Prevent attribute error for popup content.
[bsuttor]
0.1b1 (2014-08-07)
------------------
- Initial release.
[bsuttor]
==========================================================================
collective.geo.leaflet
==========================================================================
This package use the collective.geo.* suite with leaflet.
Todo
====
[ ] Get "attribution" map from registry or
[ ] Testing loading map with Robot
[ ] Add uninstall profile
[ ] Translations
[ ] Simple element view should use geojson
[ ] Use leaflet for control panel map
[ ] Use leaflet for configure map
Dependencies
============
- collective.geo.behaviour
- collective.geo.contentlocations
- collective.geo.geographer
- collective.geo.json
- collective.geo.mapwidget
- collective.geo.openlayers
- collective.geo.settings
- collective.js.leaflet
- collective.z3cform.mapwidget
- collective.z3cform.colorpicker
How to add baseLayer
====================
What is a leaflet baseLayer :
http://leafletjs.com/examples/layers-control.html
In Plone, if you want to add a baseLayer, you have to add a subscriber on collective.geo.geographer.interfaces.IGeoreferenced (for exemple, in `configure.zcml`)::
<subscriber
for="collective.geo.geographer.interfaces.IGeoreferenced"
provides="collective.geo.leaflet.interfaces.IMapLayer"
factory=".maplayers.OpenStreetMap
/>
After, create your factory in python (`maplayers.py`)::
from collective.geo.leaflet.maplayers import MapLayer
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class OpenStreetMap(MapLayer):
name = u"osm"
title = _(u"Open Street Map")
index = ViewPageTemplateFile('browser/layers/osm.pt')
And add your javascript into a template file `osm.pt`::
<script type="text/javascript">
var osmAttrib = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
var osmUrl = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png';
var %(name)s = L.tileLayer(osmUrl, {
attribution: osmAttrib,
});
</script>
Tests
=====
This package is tested using Travis CI. The current status is :
.. image:: https://travis-ci.org/collective/collective.geo.leaflet.svg
:target: https://travis-ci.org/collective/collective.geo.leaflet
Contributors
============
- Benoît Suttor, benoit.suttor@imio.be
Changelog
=========
0.1b6 (2015-01-14)
------------------
- Nothing changed yet.
0.1b5 (2015-01-06)
------------------
- Fix name of upgrade step profile.
[bsuttor]
0.1b4 (2015-01-06)
------------------
- Fix one french translation ('recheche' instead of 'recherche').
[bsuttor]
- Use Markercluster plugins (https://github.com/Leaflet/Leaflet.markercluster) with collective.js.leaflet.
[bsuttor]
0.1b3 (2014-08-26)
------------------
- Use a "local" version of leaflet-google.js downloaded from https://gist.github.com/crofty/2197042
[bsuttor]
0.1b2 (2014-08-21)
------------------
- Fix an indentation error.
[bsuttor]
- Add collective_geo_styles indexer for dexterty content.
[bsuttor]
- Prevent attribute error for popup content.
[bsuttor]
0.1b1 (2014-08-07)
------------------
- Initial release.
[bsuttor]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
collective.geo.leaflet-0.1b6.zip
(51.9 kB
view hashes)
Close
Hashes for collective.geo.leaflet-0.1b6.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | d01aa9f342bbda09bbfdd086225fcfd3929cc51b08e329e986eb2c9c1fefdc12 |
|
MD5 | 0f7d93160b36cf2c2c1f182c3f0d5ede |
|
BLAKE2b-256 | d193d9ca1ac6c237afde72127e4fd306cf1839e223da48ca34bc3c2b22a76145 |