javascript - asp.net 和 OpenLayers4:无法在弹出控件中读取 null 的属性“0”
问题描述
我正在开发一个使用 asp.net、c# 和 openlayers4 处理地图的网站。地图代码写在单独的页面map.aspx
中。ASPxPopupControl
我在主页中显示此buildings.aspx
页面。在地图页面中,我调用缩放到某个点 x,y 的方法。该代码已成功执行了数周。现在代码给了我这个错误:
Uncaught TypeError: Cannot read property '0' of null at ol.js:442
at Bn.k.qm (ol.js:442)
at Bn.b (ol.js:46)
at Bn.Sc.b (ol.js:49)
at Yc (ol.js:51)
at Bn.k.set (ol.js:51)
at Bn.k.We (ol.js:442)
这就是我所说的ol
:<script src="https://openlayers.org/en/v4.6.5/build/ol.js"></script>
导致错误的代码行
overlay.setPosition(ol.proj.transform(coordinate, 'EPSG:28191', 'EPSG:3857'));
overlay
在哪里
var container = document.getElementById('popup');
var overlay = new ol.Overlay({
element: container,
autoPan: true,
autoPanAnimation: {
duration: 250
}
});
当我从map.aspx
页面运行代码时,它可以成功运行,但如果页面显示在ASPxPopupControl
. 正如我之前所说,代码正在使用ASPxPopupControl
.
解决方案
推荐阅读
- flutter - 如何将文件转换回资产
- html - 通过 Bootstrap Nav Pill 实现 CSS3 按钮擦除效果
- javascript - 使用 javascript 切换 CSS 隐藏表格行
- ruby-on-rails - Ruby on Rails RSpec 测试模型以仅允许数据库中的一条记录
- amazon-web-services - 1亿个文件的跨账户S3副本
- python - 如何将输出文件保存在新文件夹中?现在这些存储在根目录中。指导我保存在特定位置,我想给出文件名
- mysql - 查询动态列表时 GROUP_CONCAT 中的 COUNT 不起作用
- python - 为什么我的功能部分做它应该做的事情?
- javascript - 如何减慢滚动到最高速度?
- emeditor - 如何让用户编辑器等到用户输入窗口关闭