【发布时间】:2015-04-10 17:51:03
【问题描述】:
我正在尝试让 OSMDroid 与 WMS 一起工作,但我找不到让 WMS 工作的方法。
目标:OSMDroid 使用 WMS(投影 EPSG:4326)
暂定:我遵循example 并包含文件:WMSMapTileProviderBasic、WMSMapTileDownloader、WMSTileSource、MapTile,并将以下代码放入我的活动中:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get the mapview holder
LinearLayout mapHolder = (LinearLayout) findViewById(R.id.my_osmdroid_mapview);
// create a new WMS provider
final WMSMapTileProviderBasic tileProvider = new WMSMapTileProviderBasic(getApplicationContext());
// create the WMS tile source
final ITileSource tileSource = new WMSTileSource("WMS", null, 1, 20, 256, ".jpg", "http://myserver.com/geoserver/");
tileProvider.setTileSource(tileSource);
// create a new basic map view
MapView mapView = new MapView(this, 256, new DefaultResourceProxyImpl(this), tileProvider);
// add the layout params to the view so the map fills the screen
mapView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
// add the mapview to display
mapHolder.addView(mapView);
}
}
但在地图上没有显示任何内容,为什么?
感谢您的宝贵时间。
【问题讨论】:
标签: java android osmdroid wms map-projections