Skip to main content

Use Leaflet in your django projects

Project description

django-leaflet 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>

AUTHORS

makinacom

LICENSE

  • Lesser GNU Public License
  • Leaflet Copyright - 2010-2011 CloudMade, Vladimir Agafonkin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-leaflet, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-leaflet-0.0.1.tar.gz (70.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page