简介
esri-leaflet-renderers
是一个帮助将ArcGIS Server图层在Leaflet上进行渲染的npm包。该包提供了一些自定义样式的选项,允许您按照自己的需求对地图进行美化。
安装
通过npm安装esri-leaflet-renderers
包,可以使用以下命令:
npm install esri-leaflet-renderers --save
使用
通过以下步骤来使用esri-leaflet-renderers
包:
- 引入必要的类库文件:
-- -------------------- ---- ------- ---- ------- ------- --- ----- ---------------- --------------------------------------------------------- ------- --------------------------------------------------------------- ---- ------------ ------- --- ----- ---------------- -------------------------------------------------------------------- ------- -------------------------------------------------------------------------- ---- ---------------------- ------- --- ------- -------------------------------------------------------------------------------------------------
- 创建
L.esri.basemapLayer()
实例:
var map = L.map('map').setView([39.74739, -105], 13); //创建一个底图图层 L.esri.basemapLayer('Topographic').addTo(map);
- 创建
L.esri.dynamicMapLayer()
实例并将其添加到地图上:
-- -------------------- ---- ------- ---------- --- ------------ - ------------------------ ---- ----------------------------------------------------------------------------------------- ------- --- -- --- -------------- --------------------------------- ---------------------------------------------------------- ----- --------- ------- - ----- ---------------- ------ -------- -------- - ------ -------- ------ - - - ----
示例代码
以下是一个完整的代码示例,演示如何使用esri-leaflet-renderers
包:
-- -------------------- ---- ------- --------- ----- ------ ------ ----- --------------- -- ----------- ------- --------- --------------- ----- ---------------- ------------------------------------------------------- -- ----- ---------------- ------------------------------------------------------------------ -- ------- ---- - ------- ------ - -------- ------- ------ ---- --------------- ------- --------------------------------------------------------------- ------- -------------------------------------------------------------------------- ------- ------------------------------------------------------------------------------------------------- -------- --- --- - ------------------------------- ------ ---- ---------- ---------------------------------------------- ---------- --- ------------ - ------------------------ ---- ----------------------------------------------------------------------------------------- ------- --- -- --- -------------- --------------------------------- ---------------------------------------------------------- ----- --------- ------- - ----- ---------------- ------ -------- -------- - ------ -------- ------ - - - - ----------------------------------------------------------- -------- ----------------------------------------------------------------------------------