2015-03-02 27 views
3

我有一個GeoWebCache geo server現在我想使用瓷磚來源爲我的Android應用程序。我怎樣才能做到這一點?這甚至有可能嗎?我的努力:GeoWebCache和osmdroid

mResourceProxy = new ResourceProxyImpl(this.getActivity() 
      .getApplicationContext());    
    mapView.setBuiltInZoomControls(true);  

    final MapTileProviderBasic tileProvider = new MapTileProviderBasic(this 
      .getActivity().getApplicationContext()); 
    final ITileSource tileSource = new XYTileSource("es09", null, 3, 14, 
      256, ".png", tilesURL); 
    tileProvider.setTileSource(tileSource); 
    final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this 
      .getActivity().getBaseContext()); 

    mapView.getOverlays().add(tilesOverlay); 

    mapView.setTileSource(tileSource); 
    mapView.getOverlays().add(this.mMyLocationOverlay); 
    mapView.invalidate(); 

其中tilesURLhttp://82.146.41.127:8080/geoserver/gwc/。它導致

12月3日至2日:01:25.195:W/O *的.o * .T * .M * .MapTileDow *(900):問題 下載MapTile:/ 14 /5118分之10434HTTP響應:HTTP/1.1 400 Bad 請求

另外,我應該使用什麼樣的URL?我發現tms

+0

你是什麼tilesURL的代碼?它有效嗎? – 2015-03-04 12:43:53

+0

@AmrutBidri,tilesURL是http://82.146.41.127:8080/geoserver/gwc/。 – Tony 2015-03-04 12:45:52

+0

但它是String的數組。我們可以只設置一個鏈接嗎? – 2015-03-04 12:52:27

回答

0

我會建議你使用MapBox SDK這一點。 您可以將地理服務器的鏈接設置爲WebSourceTileLayer後,它設置爲平鋪源

還挺簡單!

新增供您參考

if (layer.equalsIgnoreCase("OpenStreetMap")) 
{ 
    source = new WebSourceTileLayer(
      "openstreetmap", 
      "http://tile.openstreetmap.org/{z}/{x}/{y}.png") 
     .setName("OpenStreetMap") 
     .setAttribution("© OpenStreetMap Contributors") 
     .setMinimumZoomLevel(1) 
     .setMaximumZoomLevel(18); 
} 
mv.setTileSource(source); 
+0

與GeoWebCache服務器兼容嗎?另外,你可以在你的應用程序中檢查它嗎? – Tony 2015-03-04 13:06:15

+0

哎是的,它是GeoWebCache服務器兼容,你可以繼續在此 – Trideep 2015-03-04 13:17:37

+0

你嘗試了嗎?另外,什麼樣的網址? http://82.146.41.127:8080/geoserver/gwc/service/tms/1.0.0或http://82.146.41.127:8080/geoserver/gwc? – Tony 2015-03-04 13:20:08