mapvIEw
是一个用来显示地图的UI组件,同时还负责用户与地图的交互。
显示地图的第一步就是将map vIEw添加到xml文件中。
<?xml version="1.0" enCoding="utf-8"?><androIDx.constraintlayout.Widget.ConstraintLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:tools="http://schemas.androID.com/tools" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" tools:context=".MainActivity"> <com.esri.arcgisruntime.mapPing.vIEw.MapVIEw androID:ID="@+ID/mapVIEw" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" /></androIDx.constraintlayout.Widget.ConstraintLayout>
@H_301_17@然后
public class MainActivity extends AppCompatActivity { //创建一个MapVIEw对象 private MapVIEw mMapVIEw; @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); //设置API_KEY ArcGISRuntimeEnvironment.setAPIKey("API_KEY"); //将activity中的mapVIEw和xml文件中的mapVIEw绑定 mMapVIEw = findVIEwByID(R.ID.mapVIEw); //使用地形底图来创建一个地图 ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_topOGRAPHIC); //使用mapVIEw来展示map mMapVIEw.setMap(map); //展示在屏幕上的地图是以lat和lon为中心,放缩一万倍的地图 mMapVIEw.setVIEwpoint(new VIEwpoint(34.056295, -117.195800, 10000)); } @OverrIDe protected voID onPause() { mMapVIEw.pause(); super.onPause(); } @OverrIDe protected voID onResume() { super.onResume(); mMapVIEw.resume(); } @OverrIDe protected voID onDestroy() { mMapVIEw.dispose(); super.onDestroy(); }}
@H_301_17@Offline MapUse mobile packagesTo use a mobile package in an offline application, you first create the mobile package using ArcGIS Pro. You then sIDeload or download the package to the device.
An offline application can access a mobile package to display fully interactive maps or scenes. Mobile packages support offline applications that never have a network connection.
Mobile packages do not support editing of data content,You can use mobile packages even if a network connection is available.
Use data filesA data file is a local file stored on a device that contains data that can be displayed by a layer in a map or scene. Some data files also support editing, querying, and analyzing data
To use a data file in an offline application, you need to sIDeload or download the data file to the device. You can get data files from many sources, including desktop GIS tools such as ArcGIS Pro, data conversion scripts, and the internet. Data files are typically used in offline applications that are unable to use a network connection.
You can use the following types of data files:
Data file type | Supports editing |
---|---|
Shapefile | Yes |
Vector tile package | No |
Image tile package | No |
Scene Layer Package | No |
Local raster file | No |
OGC GeoPackage (feature data) | Yes |
OGC GeoPackage (raster data) | No |
OGC KML file | Yes |
Electronic Nautical Chart (S-57) | No |
Other (e.g. GeoJsON) | Yes |
在安卓端加载Shapefile文件的关键是ShapefileFeaturetable(com.esri.arcgisruntime.data.ShapefileFeaturetable)。
相比于.geodatabase文件,Shapefile文件的缺点在于只是单图层,且没有符号化,当然可以通过移动端的可视化API进行处理。
以上是内存溢出为你收集整理的ArcGIS Runtime API for Android学习笔记全部内容,希望文章能够帮你解决ArcGIS Runtime API for Android学习笔记所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)