1

如何使用 android SDK 获取 ArcGIS MapView 的可见地图范围角的坐标(纬度/经度)?

4

1 回答 1

1

ArcGIS 运行时 10.2.x:

SpatialReference WGS1984 = SpatialReference.create(4326);
Polygon extent = (Polygon) GeometryEngine.project(
        mapView.getExtent(),
        mapView.getSpatialReference(),
        WGS1984);
for (int i = 0; i < extent.getPointCount(); i++) {
    Point corner = extent.getPoint(i);
    // Do something with that corner, e.g. print it...
    Toast.makeText(MainActivity.this,
            "Here's a corner: " + corner.getX() + ", " + corner.getY(),
            Toast.LENGTH_LONG).show();
}

ArcGIS Runtime Quartz(测试版 3):

SpatialReference WGS1984 = SpatialReference.create(4326);
Envelope extent = (Envelope) GeometryEngine.project(
        mapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry(),
        WGS1984);
// Do something with the extent, e.g. print it...
Toast.makeText(MainActivity.this,
        "Extent:\n(" + extent.getXMin() + ", " + extent.getYMin() + "),\n" +
                "(" +  extent.getXMax() + ", " + extent.getYMax() + ")",
        Toast.LENGTH_LONG).show();
于 2016-10-11T15:32:44.000 回答