java - GeoWebCache 和 osmdroid

标签 java android openstreetmap osmdroid

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

    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): Problem downloading MapTile: /14/10434/5118 HTTP response: HTTP/1.1 400 Bad Request

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

最佳答案

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

关于java - GeoWebCache 和 osmdroid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28809502/

相关文章:

java - 异常 org.springframework.beans.factory.UnsatisfiedDependencyException

Java 正则表达式 - 字符 "("和 ")"与模式 "[\\p{Alpha} ' -,.] 匹配

android - 触摸事件 : when finger is removed from the item

android osmdroid 矢量 map

java - 如何获取 Hibernate 返回的值?

Java:您可以从您自己的类中公开第 3 方接口(interface)吗

android - 如何在 firebase 中检查用户电子邮件和密码验证以登录

android - 应用程序的预定义操作。从联系人链接到我的应用程序

reactjs - React 传单 map 位置不在 App.js 中时出现故障

python - 如何使用 Python 显示 OSM 磁贴?