ArcGIS 拾取坐標和相關(guān)文檔信息整理

AndroidStudido配置:
https://developers.arcgis.com/labs/android/create-a-starter-app/
一些簡單的功能實現(xiàn):
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表示精確到經(jīng)緯度小數(shù)點后面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 包括測量工具控件及測量接口,放大縮小控件及放大縮小接口,地圖旋轉(zhuǎn)控件及地圖旋轉(zhuǎn)接口:
https://github.com/roomanl/ArcgisTool

apk示例的一些截圖:


圖片.png

圖片.png

圖片.png

ps:基本所有的操作示例apk中都已實現(xiàn)
END

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • ¥開啟¥ 【iAPP實現(xiàn)進入界面執(zhí)行逐一顯】 〖2017-08-25 15:22:14〗 《//首先開一個線程,因...
    小菜c閱讀 7,318評論 0 17
  • 自己總結(jié)的Android開源項目及庫。 github排名https://github.com/trending,g...
    passiontim閱讀 2,742評論 1 26
  • 各種幫助類匯總:https://github.com/Blankj/AndroidUtilCode 常用的 ios...
    懦弱的me閱讀 1,507評論 0 51
  • 銀行這兩年受到的挑戰(zhàn)很大,經(jīng)濟下行,利率市場化,利差收窄,同業(yè)競爭加劇等等,那作為在銀行工作了六年的我有著什么樣 ...
    小小強話投資閱讀 11,635評論 19 25
  • 晚上吃完飯,媽媽說想去練車。這個小妞于是跟著爸爸一起去到車庫看媽媽練車。一個小時過去,還是不大行,只有一次沒有壓線...
    翱翔天空_燕子閱讀 331評論 0 1

友情鏈接更多精彩內(nèi)容