ArcGIS 拾取坐标和相关文档信息整理

AndroidStudido配置:
https://developers.arcgis.com/labs/android/create-a-starter-app/
一些简单的功能实现:
https://developers.arcgis.com/labs/?product=android&topic=any

图片.png

拾取坐标:
https://developers.arcgis.com/android/latest/java/sample-code/format-coordinates/

图片.png

只抽出拾取坐标点的代码


public class MainActivity extends AppCompatActivity {
    private MapView mMapView;
    // Graphic indicating coordinate location in the map
    private Graphic coordinateLocation;
    private TextView tv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = findViewById(R.id.tv);
        mMapView = findViewById(R.id.mapView);

        ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 16);
        mMapView.setMap(map);
        Point initialPoint = new Point(0,0, SpatialReferences.getWgs84());
        coordinateLocation = new Graphic(initialPoint,
                new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CROSS, Color.RED, 20f));
        mMapView.getGraphicsOverlays().add(new GraphicsOverlay());
        mMapView.getGraphicsOverlays().get(0).getGraphics().add(coordinateLocation);
        toCoordinateNotationFromPoint(initialPoint);
        mMapView.setOnTouchListener(new ShowCoordinatesMapTouchListener(this, mMapView));
    }

    /**
     * A map touch listener that updates formatted coordinates when a user taps on a location in the associated MapView.
     */
    private class ShowCoordinatesMapTouchListener extends DefaultMapViewOnTouchListener {

        public ShowCoordinatesMapTouchListener(Context context, MapView mapView) {
            super(context, mapView);
        }

        /**
         * Overrides the onSingleTapConfirmed gesture on the MapView, showing formatted coordinates of the tapped location.
         * @param e the motion event
         * @return true if the listener has consumed the event; false otherwise
         */
        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            // convert the screen location where user tapped into a map point
            Point tapPoint = mMapView.screenToLocation(new android.graphics.Point((int) e.getX(), (int) e.getY()));
            toCoordinateNotationFromPoint(tapPoint);
            return true;
        }

    }
    /**
     * Uses CoordinateFormatter to update the UI with coordinate notation strings based on the given Point.
     * @param newLocation Point to convert to coordinate notations
     */
    private void toCoordinateNotationFromPoint(Point newLocation) {
        if ((newLocation != null) && (! newLocation.isEmpty())) {
            coordinateLocation.setGeometry(newLocation);

            try {
                // use CoordinateFormatter to convert to Latitude Longitude, formatted as Decimal Degrees
//                mLatLongDDValue.setText(CoordinateFormatter.toLatitudeLongitude(newLocation,
//                        CoordinateFormatter.LatitudeLongitudeFormat.DECIMAL_DEGREES, 4));
                       
                tv.setText(CoordinateFormatter.toLatitudeLongitude(newLocation,
                        CoordinateFormatter.LatitudeLongitudeFormat.DECIMAL_DEGREES, 8));//8表示精确到经纬度小数点后面8位
                // use CoordinateFormatter to convert to Latitude Longitude, formatted as Degrees, Minutes, Seconds
           /*     mLatLongDMSValue.setText(CoordinateFormatter.toLatitudeLongitude(newLocation,
                        CoordinateFormatter.LatitudeLongitudeFormat.DEGREES_MINUTES_SECONDS, 1));

                // use CoordinateFormatter to convert to Universal Transverse Mercator, using latitudinal bands indicator
                mUtmValue.setText(CoordinateFormatter.toUtm(newLocation,
                        CoordinateFormatter.UtmConversionMode.LATITUDE_BAND_INDICATORS, true));

                // use CoordinateFormatter to convert to United States National Grid (USNG)
                mUSNGValue.setText(CoordinateFormatter.toUsng(newLocation, 4, true));*/
            }
            catch (ArcGISRuntimeException convertException) {
           /*     String message = String.format("%s Point at '%s'\n%s", getString(R.string.failed_convert),
                        newLocation.toString(), convertException.getMessage());
                Snackbar.make(mMapView, message, Snackbar.LENGTH_SHORT).show();*/
            }
        }
    }
    @Override
    protected void onPause(){
        mMapView.pause();
        super.onPause();
    }

    @Override
    protected void onResume(){
        super.onResume();
        mMapView.resume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mMapView.dispose();
    }

}
图片.png

apk示例下载地址:
https://arcgisruntime.maps.arcgis.com/home/item.html?id=6a214d1f4a374a9a873891707c0411ec
github代码地址:
https://github.com/Esri/arcgis-runtime-samples-android

图片.png

ArcGisTool 包括测量工具控件及测量接口,放大缩小控件及放大缩小接口,地图旋转控件及地图旋转接口:
https://github.com/roomanl/ArcgisTool

apk示例的一些截图:


图片.png

图片.png

图片.png

ps:基本所有的操作示例apk中都已实现
END

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • ¥开启¥ 【iAPP实现进入界面执行逐一显】 〖2017-08-25 15:22:14〗 《//首先开一个线程,因...
    小菜c阅读 6,573评论 0 17
  • 自己总结的Android开源项目及库。 github排名https://github.com/trending,g...
    passiontim阅读 2,593评论 1 26
  • 各种帮助类汇总:https://github.com/Blankj/AndroidUtilCode 常用的 ios...
    懦弱的me阅读 1,309评论 0 51
  • 银行这两年受到的挑战很大,经济下行,利率市场化,利差收窄,同业竞争加剧等等,那作为在银行工作了六年的我有着什么样 ...
    小小强话投资阅读 11,584评论 19 25
  • 晚上吃完饭,妈妈说想去练车。这个小妞于是跟着爸爸一起去到车库看妈妈练车。一个小时过去,还是不大行,只有一次没有压线...
    翱翔天空_燕子阅读 274评论 0 1