jquery - 如何获取地图的当前位置?(传单.js)
问题描述
我正在使用 Leaflet.js 和用户交互(发生在地图 div 之外),我想获取当前位置(纬度、经度、缩放)。
我可以找到缩放,但字段 _lastCenter 并没有让我得到实际位置,而是从地图初始化中获取坐标。
如何获取当前坐标?
this.getZoom = function () { return map._zoom }
this.getLat = function () { return map._lastCenter.lat }
this.getLon = function () { return map._lastCenter.lng }
解决方案
推荐阅读
- regex - 如何使用正则表达式检查有效的印度 pancard
- python - 带有blobTrigger的python函数没有被执行
- mongodb - MongoDB:如何使用查找查询填充嵌套对象?
- javascript - 我需要更改我正在使用 React-Select 的 React Select 框的宽度
- go - 编译为 x86 时检测 OS x86 或 x64
- flutter - 在航点内绘制折线
- scala - Spark DataFrame orderBy 和 DataFrameWriter sortBy,有区别吗?
- java - 我的搜索视图不起作用,没有过滤结果(在回收站视图中)
- c - 多线程程序如何在 C 中工作?
- javascript - 有没有办法保持第三个 div 固定