2013-05-29 21 views
0

我使用OSMdroid API顯示自定義圖塊。所以,試圖從我的本地服務器osmdroid XYTileSource不顯示自定義服務器的圖塊

這裏顯示的瓷磚是我在我宣佈以下列方式地圖視圖佈局代碼

super.onCreate(savedInstanceState); 
setContentView(R.layout.main); 

mapView = (MapView) findViewById(R.id.openmapview); 
mapView.setBuiltInZoomControls(true); 

//zoom to Netherlands 
mapView.getController().setZoom(5); 
mapView.getController().setCenter(new GeoPoint(51500000, 5400000)); 

final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext()); 
final ITileSource tileSource = new XYTileSource("SomeName", null, 3,14, 256, ".png", 
          "http://192.168.1.5/mapcache/tms/1.0.0/[email protected]/"); 
tileProvider.setTileSource(tileSource); 
final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext()); 
mapView.getOverlays().add(tilesOverlay); 

<org.osmdroid.views.MapView 
android:id="@+id/openmapview" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"/> 

任何人都可以請幫我做這工作?我的tilserver工作正常。例如我可以使用鏈接訪問地圖塊,如http://192.168.1.5/mapcache/tms/1.0.0/[email protected]/5/0/0.png

回答

0

無法評論,所以:你的logcat說什麼?當我的瓷磚沒有加載它給我一些關於它找不到它們的消息。

+0

好吧現在我可以使用osmdroid將地圖切片粘貼到Android手機。代碼與上面相同。問題是編譯器找不到osmdroid jar。我不明白爲什麼,因爲我將它們包含到用戶庫中並像那樣使用它。但這種方式沒有奏效。然後我把這些jar文件放到/ lib文件夾中。現在它正在工作。 – MWH

+0

瓷磚現在正在顯示,但它們沒有按順序排列。我不知道它爲什麼會發生。 – MWH

+0

他們是爲了什麼?我的意思是你是用Mobac還是手工製作的? –