【问题标题】:GeoWebCache and osmdroidGeoWebCache 和 osmdroid
【发布时间】:2015-03-02 12:11:45
【问题描述】:

我有一个 GeoWebCache geo server,现在我想将它用作我的 android 应用程序的磁贴源。我怎样才能做到这一点?这甚至可能吗?我的努力:

    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/。结果

03-02 12:01:25.195: W/o*.o*.t*.m*.MapTileDow*(900): 问题 下载 MapTile:/14/10434/5118 HTTP 响应:HTTP/1.1 400 错误 请求

另外,我应该使用什么样的 URL?我找到了tms

【问题讨论】:

  • 你的tilesURL是什么?有效吗?
  • @AmrutBidri,tilesURL 是82.146.41.127:8080/geoserver/gwc
  • 但它是字符串数组。我们可以在那里只设置一个链接吗?
  • @AmrutBidri,是的,你是对的。这是一个只有一个元素的数组。

标签: java android openstreetmap osmdroid


【解决方案1】:

我建议您为此使用 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);

【讨论】:

猜你喜欢
  • 2013-03-15
  • 1970-01-01
  • 1970-01-01
  • 2010-11-18
  • 1970-01-01
  • 2018-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多