0

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.

Steve
  • 25,806
  • 2
  • 33
  • 43
Mae
  • 141
  • 1
  • 2
  • 13

1 Answers1

2

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

Mae
  • 141
  • 1
  • 2
  • 13