【问题标题】:OSMDroid - Custom Marker moving as I zoom outOSMDroid - 自定义标记在我缩小时移动
【发布时间】:2013-07-16 10:18:28
【问题描述】:

我已经实现了 OSMDroid 并添加了一个这样的自定义标记:

    mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
    mapView.setTileSource(TileSourceFactory.MAPNIK);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);
    mapController = this.mapView.getController();
    mapController.setZoom(25);
    GeoPoint center = new GeoPoint(DataManager.glat, DataManager.glon);
    mapController.setCenter(center);
    OverlayItem newItem = new OverlayItem("Here", "SampleDescription", center);
    Drawable newMarker = this.getResources().getDrawable(R.drawable.marker);
    newItem.setMarker(newMarker);

此标记应位于用户的位置,默认情况下地图应居中。 这很好用,只要我不放大:

但是当我缩小时,标记会移动:

距离随着缩放级别的增加而增加:

知道这是什么原因造成的吗?自定义标记是否有任何限制/指南?

注意:使用默认标记时不会发生这种情况。

【问题讨论】:

    标签: android osmdroid


    【解决方案1】:

    发现问题:Hotspot

    似乎默认的HotspotBottom Center,就我而言,Center 是正确的。我标记的底部中心在正确的位置,只是看起来不像。

    newItem.setMarkerHotspot(HotspotPlace.CENTER); 已修复

    这基本上是我的标记:

     ___________
    |     _     |
    |    ( )    |
    |     V     |
    |           |
    |___________|
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-05
      • 1970-01-01
      • 2018-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多