简体   繁体   English

Mapbox 轨迹查看 Android

[英]Mapbox trail view Android

how to create clickable trail with info about this trail in Mapbox ?如何在 Mapbox 中使用有关此路径的信息创建可点击的路径? I have trails from GEOJsoN like:我有来自 GEOJsoN 的足迹,例如:

  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [12.691956, 52.943673],
          [12.727661, 52.912215],
          [12.757874, 52.88902],
          [12.7771, 52.859181],
          [12.799072, 52.822683],
          [12.801819, 52.784492]
        ]
      }
    }
  ]
}

In mapbox.com I read it is possible with markers but only when i have 2 diffrents API (trails and marker)在 mapbox.com 中,我读到可以使用标记,但仅当我有 2 个不同的 API(轨迹和标记)时

You can make use of the Annotation Plugin which supports event listeners.您可以使用支持事件侦听器的 Annotation Plugin。

  1. Create a Line using the LineManager using the Annotation Plugin.使用注释插件使用 LineManager创建一条线

  2. Add a clickListener to that LineManager.向该 LineManager 添加一个 clickListener

  3. Define the action that should be executed when the Line is clicked on:定义单击 Line 时应执行的操作:

 lineManager.addClickListener(new OnSymbolClickListener() { @Override public boolean onAnnotationClick(Symbol symbol) { // Do stuff here } });

Also see this example that adds a onClickListener to a Symbolmanager.另请参阅此示例该示例将 onClickListener 添加到 Symbolmanager。 It displays a toast when clicked.单击它时会显示一个祝酒词。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM