学习Arcgis for android 日志

由于业务要求需要,今天开始接触一些Arcgis相关的知识,首先了解了Arcgis的使用范围和功能等,接着就开始着手准备自己的Demo了。

1.需要配置开发Arcgis的环境

  我这里是使用libs关联库来实现(.so文件、.jar文件及相关需求的jar包),这里不做赘述

2.实现mapView显示的helloword

  2-1:xml文件

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    
    <!-- MapView layout and initial extent -->
    <com.esri.android.map.MapView
  android:id="@+id/map"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  initExtent = "-19332033.11, -3516.27, -1720941.80, 11737211.28">
  </com.esri.android.map.MapView> 
 
</LinearLayout>

  2-2:Activity

 public class HelloWorld extends Activity {
MapView mMapView = null;
ArcGISTiledMapServiceLayer tileLayer;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Retrieve the map and initial extent from XML layout
mMapView = (MapView)findViewById(R.id.map);
/* create a @ArcGISTiledMapServiceLayer */
tileLayer = new ArcGISTiledMapServiceLayer(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
// Add tiled layer to MapView
mMapView.addLayer(tileLayer);
}



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


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

}

3.其他的一些知识点(API):

 mMapView.addLayer(basemapStreet);//添加图层

Layer[] layers=map.getLayers();//获得图层数组数据

 map.setAllowRotationByPinch(true);//设置允许利用双指或多指进行旋转
  map.addView(compass);//在map上添加一个view


 map的监听事件:
  setOnLongPressListener();设置地图长按事件监听
  setOnPanListener();设置地图平移事件监听
  setOnPinchListener();设置地图捏夹事件监听
  setOnSingleTapListener();设置地图单击事件监听
  setOnZoomListener();设置缩放监听

 Polygon extent=map.getExtent();//获得地图最小外包矩形

  Envelope envolope=map.getMapBoundaryExtent();//获取地图的边界
  map.setExtent(Geometry geometry);//将地图放大到指定的范围,并将该geometry的bound作为地图当前的extent

 Arcgis作用非常强大,我将继续学习,并与大家分享

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值