django-leaflet 0.11.1

Use Leaflet in your Django projects

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!

What's new in django-leaflet 0.11.0:

  • Add control of `metric` and `imperial` in `SCALE` option (thanks @smcoll)
  • Upgrade to Leaflet.draw 0.2.3
Read full changelog
send us
an update
LICENSE TYPE:
GPL (GNU General Public License) 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Mathieu Leplatre
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Internet \ Django Plugins
django-leaflet is a Django app that allows you to use Leaflet (version 0.3) in your Django projects.

INSTALL

pip install django-leaflet

USAGE

 Add leaflet to your INSTALLED_APPS
 Add the HTML header :

{% load leaflet_tags %}

< head >
 ...
 {% leaflet_js %}
 {% leaflet_css %}
< /head >


 Add the map in your page :

...
< body >
 ...
 {% leaflet_map "yourmap" %}
 ...
< /body >


 Use the Leaflet API as usual on the resulting yourmap object :

< script type="text/javascript" >
 ...
 // Add background layer from MapBox
 yourmap.addLayer(new L.TileLayer('http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-light/{z}/{x}/{y}.png'));
 ...
< /script >


 Give your maps a size (mandatory) :

< style >

 .leaflet-container {
 width: 600px;
 height: 400px;
 }

 #specialbigmap {
 height: 800px;
 }

< /style >

Last updated on September 24th, 2012

requirements

#Django Leaflet #Django projects #Django #Leaflet #projects #API

Add your review!

SUBMIT