如果已经回答,请提前道歉。我在网上或存储库中找不到任何指向我的问题的东西。
我有一个ArrayList<Position>
握住我的线刺痛的东西。
绘制时此显示很好addPolyline
我想设置线条的样式,所以我切换到使用线条图层。然而。
该线不再出现在靠近正确位置的任何地方。该位置位于英格兰坎布里亚郡,但位于索马里海岸。
我试图在每次转换后输出坐标,它们看起来都很好。我不知道如何检查source
Log.d("Tracing 1", route.toString())
val lineString = LineString.fromCoordinates(route)
Log.d("Tracing 2", lineString.coordinates.toString())
val feature = Feature.fromGeometry(lineString)
Log.d("Tracing 3", feature.geometry.coordinates.toString())
val featureCollection = FeatureCollection.fromFeatures(
arrayOf(feature))
val geoJsonSource: Source = GeoJsonSource("line-source", featureCollection)
mapboxMap.addSource(geoJsonSource)
val debugSource = mapboxMap.getSource("line-source") as GeoJsonSource
Log.d("Tracing 4", debugSource.toString())
val lineLayer = LineLayer("linelayer", "line-source")
lineLayer.setProperties(
PropertyFactory.lineDasharray(arrayOf(0.01f, 2f)),
PropertyFactory.lineCap(LINE_CAP_ROUND),
PropertyFactory.lineJoin(LINE_JOIN_ROUND),
PropertyFactory.lineWidth(5f),
PropertyFactory.lineColor(Color.parseColor("#e55e5e"))
)
mapboxMap.addLayer(lineLayer)
val cameraPosition = CameraPosition.Builder()
.target(LatLng(route[0].latitude, route[0].longitude))
.build()
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
显示Log
s 都相同的 log cat 输出在这里。
10-05 20:52:37.162 11449-11449/com.xxx.xxx D/Tracing 1: [Position [longitude=54.82269833333333, latitude=-2.8017883333333335, altitude=NaN], Position [longitude=54.82289833333333, latitude=-2.80173, altitude=NaN], Position [longitude=54.823098333333334, latitude=-2.8015583333333334, altitude=NaN], Position [longitude=54.8233, latitude=-2.8012799999999998, altitude=NaN], Position [longitude=54.82339833333334, latitude=-2.801078333333333, altitude=NaN], Position [longitude=54.82379833333333, latitude=-2.8007583333333335, altitude=NaN], Position [longitude=54.8241, latitude=-2.8004183333333335, altitude=NaN]]
10-05 20:52:37.172 11449-11449/com.xxx.xxx D/Tracing 2: [Position [longitude=54.82269833333333, latitude=-2.8017883333333335, altitude=NaN], Position [longitude=54.82289833333333, latitude=-2.80173, altitude=NaN], Position [longitude=54.823098333333334, latitude=-2.8015583333333334, altitude=NaN], Position [longitude=54.8233, latitude=-2.8012799999999998, altitude=NaN], Position [longitude=54.82339833333334, latitude=-2.801078333333333, altitude=NaN], Position [longitude=54.82379833333333, latitude=-2.8007583333333335, altitude=NaN], Position [longitude=54.8241, latitude=-2.8004183333333335, altitude=NaN]]
10-05 20:52:37.172 11449-11449/com.xxx.xxx D/Tracing 3: [Position [longitude=54.82269833333333, latitude=-2.8017883333333335, altitude=NaN], Position [longitude=54.82289833333333, latitude=-2.80173, altitude=NaN], Position [longitude=54.823098333333334, latitude=-2.8015583333333334, altitude=NaN], Position [longitude=54.8233, latitude=-2.8012799999999998, altitude=NaN], Position [longitude=54.82339833333334, latitude=-2.801078333333333, altitude=NaN], Position [longitude=54.82379833333333, latitude=-2.8007583333333335, altitude=NaN], Position [longitude=54.8241, latitude=-2.8004183333333335, altitude=NaN]]
10-05 20:52:37.182 11449-11449/com.xxx.xxx D/Tracing 4: com.mapbox.mapboxsdk.style.sources.GeoJsonSource@9d382a28
我的问题是;我做错了什么我错过了什么吗?
谢谢