问题描述
我的要求是能够调用一个向我返回GeoJson的API-该API需要以经度/纬度坐标表示边框。我希望能够为每个图块调用此api,但在尝试将L.Coords
x,y,z值转换为界限时陷入困境。
我本以为这将是一个常见的用例-还有其他方法可以解决这个问题吗?
L.TileLayer.Custom = L.TileLayer.extend({
getTileUrl: (coords: L.Coords) => {
const bounds = coords?.getBounds();
const geometry = {
ymin: bounds?.getSouth(),xmin: bounds?.getWest(),ymax: bounds?.getnorth(),xmax: bounds?.getEast()
};
// call api Api.call(geometry).then(...)
},});
L.tileLayer.custom = function () {
return new L.TileLayer.Custom();
};
L.tileLayer.custom().addTo(map);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)