gpt4 book ai didi

javascript - OpenStreetMap leafletjs 删除树层

转载 作者:行者123 更新时间:2023-11-30 08:23:54 26 4
gpt4 key购买 nike

如何删除 openstreetmap 上的树层(可能是一个 tileLayer),如下图所示。有没有办法也删除 map 上的所有点和线?

enter image description here

var map = L.map('map', {
scrollWheelZoom: false
}).fitBounds(
[
[driverLocation.latitude, driverLocation.longitude],
[customerDeliveryLocation.latitude, customerDeliveryLocation.longitude]
],
{ padding: [80, 80] }
);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> bidragsgivare'
}).addTo(map);

var LeafIcon = L.Icon.extend({
options: { iconSize: [34, 34] }
});

最佳答案

正如@ghybs 所解释的,Leaflet 加载已经渲染的图像,因此您不能即时更改它们。

如果你想尝试不同的 map vendor ,看看这个项目:https://leaflet-extras.github.io/leaflet-providers/preview/并选择最适合您需求的样式。

你也可以试试Mapbox Studio如果您想设计自己的风格。

关于javascript - OpenStreetMap leafletjs 删除树层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48790724/

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