ArcGIS Runtime API for Android学习笔记

ArcGIS Runtime API for Android学习笔记,第1张

概述ArcGISRuntimeAPIforAndroid学习笔记Displayamapmapview是一个用来显示地图的UI组件,同时还负责用户与地图的交互。显示地图的第一步就是将mapview添加到xml文件中。<?xmlversion="1.0"encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayoutx ArcGIS Runtime API for AndroID学习笔记display a map

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 packages

To 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 files

A 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 typeSupports editing
ShapefileYes
Vector tile packageNo
Image tile packageNo
Scene Layer PackageNo
Local raster fileNo
OGC GeoPackage (feature data)Yes
OGC GeoPackage (raster data)No
OGC KML fileYes
Electronic Nautical Chart (S-57)No
Other (e.g. GeoJsON)Yes

在安卓端加载Shapefile文件的关键是ShapefileFeaturetable(com.esri.arcgisruntime.data.ShapefileFeaturetable)。
相比于.geodatabase文件,Shapefile文件的缺点在于只是单图层,且没有符号化,当然可以通过移动端的可视化API进行处理。

将shp文件拷贝到模拟器的SD卡中找到自己安装SDK的目录进入SDK目录下的tools文件双击monitor.bat文件(monitor.bat打不开的问题:AndroidStudio3.x 打开Android Device Monitor正确做法)出现如下界面

点击file Explorer找到sdcard文件所在位置(可能在mnt下,也有可能在外面)点击右上角的导入即可拷贝文件 总结

以上是内存溢出为你收集整理的ArcGIS Runtime API for Android学习笔记全部内容,希望文章能够帮你解决ArcGIS Runtime API for Android学习笔记所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1005691.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存