【问题标题】:Android-Java Point(android.graphics.point) in Point cannot be applied to (Double, Double)Point 中的 Android-Java Point(android.graphics.point) 不能应用于 (Double, Double)
【发布时间】:2015-05-24 09:35:41
【问题描述】:

我正在使用 ArcGis 解决方案来获取用户的当前位置。每当我想要 getLongitude 和 getLatitude 时,它​​都会给出一个错误,即点无法转换为 Double。

如何解决这个问题?

Point curLocation;
final SpatialReference wm = SpatialReference.create(102100);
final SpatialReference egs = SpatialReference.create(4326);



public void onLocationChanged(Location location) {
        if (location == null)
            return;

        boolean zoomToMe = (curLocation == null);
        curLocation = new Point(location.getLongitude());

        if (zoomToMe) {
            Point p = (Point) GeometryEngine.project(curLocation, egs, wm);
            mMapView.zoomToResolution(p, 5.0);
        }
    }

【问题讨论】:

    标签: java android point arcgis esri


    【解决方案1】:

    一个点需要两个整数作为参数。你传给它一个双倍。您可以使用需要 2 个浮点数的 PointF,但即使这样也会丢失数据。

    您是否使用了另一个使用自定义 Point 类的库(arcgis 出现在网络搜索中)?如果是这样,请确保您正在导入 the correct version of Point

    import com.esri.core.geometry.Point;
    

    【讨论】:

    • @Kamilah,有一个按钮。 (即接受 Gabe 的回答...)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-12
    • 2020-11-26
    • 2012-02-26
    • 1970-01-01
    • 2021-07-05
    • 2022-10-20
    相关资源
    最近更新 更多