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.

Source Distribution

django-leaflet-0.0.1.tar.gz (70.4 kB view details)

Uploaded Source

File details

Details for the file django-leaflet-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-leaflet-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ed3f949a81c1cfc772c8303cf3e7189b638adba1a0b9e58dc6a3a475a63860c9
MD5 fdd00e0d4f41284cc2ffbcaebac44e17
BLAKE2b-256 54b12706ee31b209e5623daf3fc03f0049c3c410f306cd76982cf699d0dffbee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page