ArcGIS for Android Basics Case (code section)

ARCGIS FOR ANDROID 100.3.0: Getting Case

The first part describes how to configure the development environment, now write a case entry

Layout file:

  <com.esri.arcgisruntime.mapping.view.MapView
        android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.esri.arcgisruntime.mapping.view.MapView>

Code:

public class Main1Activity extends AppCompatActivity {

    private MapView mMapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main1);

        mMapView = (MapView) findViewById(R.id.mapview);

        /**
         * 参数1:Basemap.Type:底图类型
         * 参数2:形成地图中心点的初始视点的纬度
         * 参数3:形成地图中心点的初始视点的经度
         * 参数4:转换为初始Viewpoint的比例的详细程度。0是缩小最多的级别。
         */
        ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 16);
        // set the map to be displayed in this view
        mMapView.setMap(map);
    }

    @Override
    protected void onPause() {
        super.onPause();
        mMapView.pause();
    }

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

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

Renderings:

è¿éåå¾çæè¿ °

 

Basemap.Type: base map types

Can see specifically what type of map api

https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/Basemap.Type.html

Arcgis built some maps


        ArcGISMap arcGISMap1 = new ArcGISMap(Basemap.createStreets());
        ArcGISMap arcGISMap2 = new ArcGISMap(Basemap.createImagery());
        ArcGISMap arcGISMap3 = new ArcGISMap(Basemap.createStreetsVector());

        ArcGISMap arcGISMap4 = new ArcGISMap(Basemap.createTopographic());

        //初始化可见区域
        Envelope targetExtent = new Envelope(-13639984.0, 4537387.0, -13606734.0, 4558866.0,
                SpatialReferences.getWebMercator());
        Viewpoint initViewpoint = new Viewpoint(targetExtent);
        arcGISMap4.setInitialViewpoint(initViewpoint);

        mMapView.setMap(arcGISMap4);
Released five original articles · won praise 3 · Views 2101

Guess you like

Origin blog.csdn.net/qq_19688207/article/details/104550624