【移动GIS】自定义在线地图

Osmdroid中,使用自定义瓦片,在线模式地图,设置方式如下:

/**
 * 在线地图 
 * 
 * 
 */
public class OnlineTilesDemo extends Activity {
	private MapView mapView;
	public  RelativeLayout rl;
	public  MapTileProviderArray mProvider;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		
		final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
		final ITileSource tileSource = new XYTileSource("map", ResourceProxy.string.online_mode, 1, 7, 256, ".png",
				"http://10.2.25.11:9080/MapServer/");
		tileProvider.setTileSource(tileSource);
		DefaultResourceProxyImpl mResourceProxy = new DefaultResourceProxyImpl(
				this.getApplicationContext());
		mapView = new MapView(this,256);
		mapView = new MapView(this, 256, mResourceProxy, tileProvider);
		
		
		mapView.getController().setZoom(6);
		mapView.getController().setCenter(new GeoPoint(36.5447278702, 104.1347919517));
		ScaleBarOverlay scaleBar = new ScaleBarOverlay(getApplicationContext());//比例尺
		mapView.getOverlays().add(scaleBar);
		
		rl = new RelativeLayout(this);
		rl.addView(mapView, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT));
		
		this.setContentView(rl);		
	}
	
}


 

你可能感兴趣的:(Gis,地图,osmdroid,在线地图)