【发布时间】:2018-07-24 10:35:16
【问题描述】:
我使用符号层在地图上绘制一堆点:
var imgId = R.drawable.ic_route_stop
var featureCollection = FeatureCollection.fromFeatures(mSelectedBusStops!!.map { stop ->
Feature.fromGeometry(com.mapbox.geojson.Point.fromLngLat(
stop.Lon.toDouble(),
stop.Lat.toDouble()))
});
map?.addSource(
GeoJsonSource(mMarkerSourceIdentifier,
featureCollection,
GeoJsonOptions()
))
val image = BitmapFactory.decodeResource(activity?.resources, imgId)
map?.addImage(mMarkerImgIdentifier, image)
var layer = SymbolLayer(mMarkerStyleLayerIdentifier, mMarkerSourceIdentifier)
layer.setProperties(PropertyFactory.iconImage(mMarkerImgIdentifier),
PropertyFactory.iconAllowOverlap(true))
map?.addLayer(layer)
之后我在地图中添加了几个标记(这些标记需要定期动画)
mSelectedBusCurrentStops?.forEach { stop ->
(map ?: return).addMarker(MarkerOptions()
.icon(icon)
.position(LatLng(stop.lat, stop.lon)))
}
这里的重要部分是标记,我稍后添加的,这些标记应该始终可见。但是我的符号层隐藏了标记图标,我需要将标记放在前面。有什么办法可以解决吗?
这就是它的样子
【问题讨论】:
标签: android kotlin mapbox mapbox-android mapbox-marker