如何使用android SDK获取ArcGIS MapView的可见地图范围角的坐标(lat / lon)?
答案 0 :(得分:0)
ArcGIS Runtime 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(Beta 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();