You are here: Home / LBN / Up2date / Plone and Zope / BastionLinux 19 / collective.geo.leaflet-0.2.3-1.lbn19.noarch

collective.geo.leaflet-0.2.3-1.lbn19.noarch

Package Attributes
RPM  collective.geo.leaflet-0.2.3-1.lbn19.noarch.rpm Architecture  noarch Size  94543 Created  2019/09/30 06:55:04 UTC
Package Specification
Summary Add geo views for dexterity content with leaflet js library
Group Application/Internet
License ZPL
Home Page https://pypi.python.org/packages/source/c/collective.geo.leaflet/collective.geo.leaflet-0.2.3.zip
Description

This package use the collective.geo.* suite with leaflet.

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 = '&copy; <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>
Requires
rpmlib(PayloadFilesHavePrefix)  
rpmlib(FileDigests)  
rpmlib(CompressedFileNames)  
python  
/bin/sh  
rpmlib(PartialHardlinkSets)  
rpmlib(PayloadIsXz)  
Provides
collective.geo.leaflet
python2.7dist(collective.geo.leaflet)
python2dist(collective.geo.leaflet)

Document Actions