简体   繁体   English

Mapbox 显示经纬度和缩放,然后将它们放入文本框

[英]Mapbox Display Lat and Lng and Zoom then putting them inside a textbox

enter image description here在此处输入图片说明

I was wondering how to actually get the lat and lng and zoom values like in the picture example on mapbox style builder not with a mouse click or with a mouse move, just the entire map inside a div.我想知道如何像在地图框样式构建器上的图片示例中那样实际获取 lat 和 lng 以及缩放值,而不是通过鼠标单击或鼠标移动,而只是在 div 中获取整个地图。

So explaining in detail, I was wondering if there was a way to grab the maps coordinates and display them based off of what mapbox does in there studio editor.所以详细解释一下,我想知道是否有办法获取地图坐标并根据 mapbox 在工作室编辑器中的作用来显示它们。 They calculate the lat and lng and zoom level of their whole map and when a user scrolls around the map the lat and lng changes and it displays the new coordinates with the zoom level.他们计算整个地图的 lat 和 lng 以及缩放级别,当用户在地图上滚动时,lat 和 lng 会发生变化,并显示具有缩放级别的新坐标。 I need to take those values and place them inside a textbox.我需要获取这些值并将它们放在文本框中。

You have several samples on this.你有这方面的几个样本。

how to get the coords of a point 如何获得一个点的坐标
how to create a draggable marker 如何创建可拖动标记
how to get the coords of cursor如何获取光标的坐标

If you need the zoom too, you only need to addmap.getZoom() to he methods that are painting the lngLat.lng and lngLat.lat如果您也需要缩放,则只需将map.getZoom()添加到绘制lngLat.lnglngLat.lat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MapBox - 如何在列表内的 select 地址之后在 div 内显示纬度和经度坐标 - MapBox - How to display lat and lng coordinates inside a div after select address inside a list 单击 Mapbox GL JS 显示经纬度坐标 - Display Lat Lng Coordinates on click on Mapbox GL JS 如何在字段集中显示 lat 和 lng 坐标(<input type="“text”" name="“lng”" id="“lng”" placeholder="“Longitude”"> )? - How can i display lat and lng coordinates inside a fieldset(<input type=“text” name=“lng” id=“lng” placeholder=“Longitude”>)? 如何将 lng 和 lat 从 OpenLayers 转换为 mapbox? - How can I convert lng and lat from OpenLayers to mapbox? 在不规则形状的多边形内获取经/纬度 - Get lat/lng inside an irregular shape polygon 功能缩放至群集以相同纬度/经度关闭具有多个标记的群集 - function zoom to cluster closes cluster with multiple markers at same lat/lng 从Google街景视图获取经度/纬度/缩放/偏航/倾斜 - Getting lat/lng/zoom/yaw/pitch from Google Street View Google地图地理编码。 在2个文本框中显示经纬度的功能 - Google maps geocoding. Function to display lat and lng in 2 textboxws Leaflet 在显示位置重复时提供无效的 Lng/Lat 坐标 - Leaflet Providing invalid Lng/Lat coordinates when location duplicates on display 如何使用 h3-js 在多边形内找到点(lat,lng)? - How to find point (lat, lng) inside a polygon with h3-js?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM