Development and Implementation of Android Intelligent Map V: Online Base Map - ArcGIS Runtime SDK for Android (Version 100.0.0)

Keywords: Android Mobile REST

Foundation map

The foundation of mobile map program is "a map", which needs a basic base map to support field mapping, navigation, results display, statistical application, etc. Often the quality of the base map determines the basis of the whole mobile map.

Online Tiled Layers

The online base map includes traditional GIS (ArcGIS Server) and WebGIS (Online & Portal). The use of traditional GIS is really different. Traditional GIS is based on Layer's direct service to Ground Map (ArcGIS Server). WebGIS is connected to WebMap through ArcGIS Map.

WebGIS(Online & Portal)

With Online or Portal, we can easily and quickly produce more concise and intelligent map resources to express our purpose. For mobile terminals, these Web Map s can be directly applied.

package hymn.esrichina.displayamaponlineandportal;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.LayerList;
import com.esri.arcgisruntime.mapping.view.MapView;

public class MainActivity extends AppCompatActivity {
    private MapView mainMapView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            String theURLString = 
            "http://www.arcgis.com/home/webmap/viewer.html?webmap=55c1665bcd064552944a9e8296271ec3";
            mainMapView = (MapView) findViewById(R.id.mainMapView);
            ArcGISMap mainArcGISMap = new ArcGISMap(theURLString);
            Basemap mainBasemap = mainArcGISMap.getBasemap();
            LayerList mainLayerList = mainArcGISMap.getOperationalLayers();
            mainMapView.setMap(mainArcGISMap);
        }
        catch (Exception e)
        {

        }
    }
}

Traditional GIS

For those who have been using ArcGIS Server to publish map services, you can directly use the Map Service (Layer) to load online map services (ArcGIS Server).

package hymn.esrichina.displayamaparcgisserver;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.LayerList;
import com.esri.arcgisruntime.mapping.view.MapView;

public class MainActivity extends AppCompatActivity {
    private MapView mainMapView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            String theURLString = 
            "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer";
            mainMapView = (MapView) findViewById(R.id.mainMapView);
            ArcGISTiledLayer mainArcGISTiledLayer = new ArcGISTiledLayer(theURLString);
            Basemap mainBasemap = new Basemap(mainArcGISTiledLayer);
            ArcGISMap mainArcGISMap = new ArcGISMap(mainBasemap);
            mainMapView.setMap(mainArcGISMap);
        }
        catch (Exception e)
        {

        }
    }
}

On-line vector slicing

The new vector slice of ArcGIS also has online mode, which is also a good choice.

package hymn.esrichina.displayamapvtpkonline;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.layers.ArcGISVectorTiledLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Viewpoint;
import com.esri.arcgisruntime.mapping.view.MapView;

public class MainActivity extends AppCompatActivity {
    private MapView mainMapView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            String theOfflineTiledLayers = 
            "https://www.arcgis.com/home/item.html?id=e19e9330bf08490ca8353d76b5e2e658";
            mainMapView = (MapView) findViewById(R.id.mainMapView);
            ArcGISVectorTiledLayer mainArcGISVectorTiledLayer = new ArcGISVectorTiledLayer(theOfflineTiledLayers);
            Basemap mainBasemap = new Basemap(mainArcGISVectorTiledLayer);
            ArcGISMap mainArcGISMap = new ArcGISMap(mainBasemap);
            mainMapView.setMap(mainArcGISMap);
            Viewpoint vp = new Viewpoint(47.606726, -122.335564, 72223.819286);
            mainArcGISMap.setInitialViewpoint(vp);
        }
        catch (Exception e)
        {

        }
    }
}

Ending

The source program includes:

  1. DisplayAMapOnlineAndPortal
  2. DisplayAMapArcGISServer
  3. DisplayAMapVTPKOnline

Please download:
http://pan.baidu.com/s/1jIDlYyM Password: 6cvh
If invalid, you can send an email to polyline@126.com for request.

Posted by mpb001 on Tue, 12 Feb 2019 11:39:18 -0800