Django-Leaflet - set dynamic layers

440 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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