djangoleaflettilesesri-leafletesri-oss

Django-Leaflet - set dynamic layers


I want to set DynamicMapLayer to my django-leaflet template. Maybe anyone knows how can I do it?

I prefer this like L.esri.dynamicMapLayer, maybe L.esri.featureLayer from esri-leaflet.js plugin.


Solution

  • I solved the problem. I forgot about 'PLUGINS' at settings.py.

    'PLUGINS': {
        'esri-leaflet': {
            'css': '',
            'js': 'libs/esri-leaflet/dist/esri-leaflet.js',
            'auto-include': True,
        }
    },
    

    Then add it to template:

    <head>
        ...
        {% leaflet_js plugins="ALL" %}
        {% leaflet_css plugins="ALL" %}
    </head>
    <body>
        ....
        L.esri.dynamicMapLayer({
            url: 'http://mytilesURL',
            ...
        }).addTo(map);
        ....
    </body>
    

    Source: django-leaflet docs