android ArcGIS学习笔记一

动态操作地图服务
1.动态添加一个地图服务
String url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer";
ArcGISDynamicMapServiceLayer arcGISDynamicMapServiceLayer=new ArcGISDynamicMapServiceLayer(HelloWorld.this,HelloWorld.this.url);
map.addLayer(arcGISDynamicMapServiceLayer);
2.移除地图服务
map.removeLayer();
reorderLayer();




导航与触屏操作
1.放大
map.zoomin();
2.缩小
map.zoomout();
3.取得当前长按位置坐标
this.map.setOnLongPressListener(new OnLongPressListener(){


@Override
public void onLongPress(float x, float y) {
Point point=HelloWorld.this.map.toMapPoint(x,y);
showStation.setText("X:"+point.getX()+"Y:"+point.getY());
}


});
4.mapView的事件
OnLongPressListener 在MapView 上长按时
OnMapExtentChangedListener MapView 的地图范围改变时
OnPanListener 在MapView 中拖劢地图时
OnPinchListener 在MapView 上两指缩放操作时
OnSingleTapListener 在MapView 上单击时
OnStatusChangedListener 在MapView 的状态改变,比如被创建戒刜始化时
OnZoomListener 在MapView 被缩放时
MapOnTouchListener 在MapView 上按住并移劢(类似绘图操作)时




用户要素
1.添加用户要素
graphicsLayer=(GraphicsLayer) findViewById(R.id.glayer);
graphicsLayer.setRenderer(new SimpleRenderer(new SimpleMarkerSymbol(Color.RED,20,STYLE.SQUARE)));


Graphic graphic=new Graphic();
graphic.setGeometry(HelloWorld.this.map.getCenter());
graphicsLayer.addGraphic(graphic);
graphicsLayer.postInvalidate();
2.添加用户要素使用指定图片
Drawable drawable=this.getBaseContext().getResources().getDrawable(R.drawable.icon);
graphicsLayer.setRenderer(new SimpleRenderer(new PictureMarkerSymbol(drawable)));
Graphic graphic=new Graphic();
graphic.setGeometry(HelloWorld.this.map.getCenter());
graphicsLayer.addGraphic(graphic);
graphicsLayer.postInvalidate();
3.分类渲染或是唯一值渲染




graphicsLayer=(GraphicsLayer) findViewById(R.id.glayer);
//分类渲染或是唯一值渲染
ClassBreaksRenderer breaksRenderer=new ClassBreaksRenderer();
breaksRenderer.setField("class");
breaksRenderer.setMinValue(0);

ClassBreak cb1=new ClassBreak();
cb1.setClassMaxValue(0.5);
cb1.setSymbol(new SimpleMarkerSymbol(Color.RED,20,SimpleMarkerSymbol.STYLE.CIRCLE));
breaksRenderer.addClassBreak(cb1);

ClassBreak cb2=new ClassBreak();
cb1.setClassMaxValue(1);
cb1.setSymbol(new SimpleMarkerSymbol(Color.GREEN,20,SimpleMarkerSymbol.STYLE.CIRCLE));
breaksRenderer.addClassBreak(cb2);

graphicsLayer.setRenderer(breaksRenderer);


//添加用户要素
Graphic graphic=new Graphic();
//分类渲染或是唯一值渲染时使用
graphic.setAttributeValue("class", Math.random());
graphic.setGeometry(HelloWorld.this.map.getCenter());
graphicsLayer.addGraphic(graphic);
graphicsLayer.postInvalidate();


通过交互绘制几何图相
查询与实别

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值