gpt4 book ai didi

java - Leaflet.editable 在顶点的工具提示中显示坐标

转载 作者:行者123 更新时间:2023-12-01 21:48:28 25 4
gpt4 key购买 nike

我正在使用 leaflet.editable 修改 geoJSON 对象,我想显示带有 GPS 坐标的顶点的工具提示。有没有办法修改顶点来设置工具提示甚至可能使用的图标?

最佳答案

覆盖每个图层类型的默认启用编辑功能:(您必须自己编程,工具提示始终显示!)

L.Polygon.prototype.enableEdit = function (map) {
if (!this.editor) this.createEditor(map);
this.editor.enable();
this.editor.editLayer.eachLayer(function(layer){layer.bindTooltip(""+layer.getLatLng()).openTooltip(); });
return this.editor;
}

更改图标最快的方法是更改​​ css 样式:

.leaflet-div-icon {
background: #c72e2e; //maybe you have to add !important
border-radius: 50%;
}

您也可以尝试更改 VertexIcon https://github.com/Leaflet/Leaflet.Editable/blob/bffa390d3f4caaeb74f74ceba460adc8f283d340/src/Leaflet.Editable.js#L439

关于java - Leaflet.editable 在顶点的工具提示中显示坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58772223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com