动态操作地图服务
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();
通过交互绘制几何图相
查询与实别
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();
通过交互绘制几何图相
查询与实别