Django-Leaflet - 设置动态图层

时间:2016-09-01 08:53:01

标签: django leaflet tiles esri-leaflet esri-oss

我想将DynamicMapLayer设置为我的django-leaflet模板。也许有人知道我该怎么做?

我更喜欢L.esri.dynamicMapLayerL.esri.featureLayer来自esri-leaflet.js插件。

1 个答案:

答案 0 :(得分:2)

我解决了这个问题。我在settings.py忘记了'PLUGINS'

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

然后将其添加到模板:

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

来源:django-leaflet docs