【问题标题】:Take maps Lat/Long on centre point of screen在屏幕中心点获取地图纬度/经度
【发布时间】:2022-03-07 16:15:53
【问题描述】:

有谁知道如何从屏幕中心点获取地图坐标?

有几个不同的答案,但它们都适用于 Google 地图 -

Flutter: how to get location coordinates of point in the center of screen

我正在使用 HERE 地图。

谢谢

【问题讨论】:

    标签: flutter dart here-api


    【解决方案1】:

    user guide所示,只需调用即可:

    hereMapController.camera.state.targetCoordinates
    

    在 HERE 的术语中,目标指定了相机的观察点。默认情况下,它会查看地图视图的中心,除非它已被主点更改。

    当以编程方式平移或移动地图时,相机仍会注视地图视图的中心,因此每次都会更新值。

    【讨论】:

      【解决方案2】:

      如果您知道屏幕坐标中地图视图的中心,那么使用 viewCoordinates 方法可以将视图坐标转换为地理坐标。

      如果 MapView 没有附加渲染表面,它将返回 null。这发生在加载地图场景之前或地图视图被破坏之后。

      详情可以在这里找到。

      https://developer.here.com/documentation/flutter-sdk-navigate/4.10.3.0/api_reference/mapview/MapViewBase/viewToGeoCoordinates.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-11
        相关资源
        最近更新 更多