简体   繁体   English

(Android) 使用 a.geojson 文件在 map 上画一条线

[英](Android) Draw a line on the map using a .geojson file

I am working on a bus application and I need to show a route that is used.我正在开发一个公共汽车应用程序,我需要显示一条使用的路线。 With that, I used the MapBox website, drew a route using the data set and the logo after I exported a route in.geojson format, I would like to know if I can draw a line on my map on android from this file, instead of placing a point to point in the code.有了这个,我使用了 MapBox 网站,在我以 .geojson 格式导出路线后,使用数据集和徽标绘制了一条路线,我想知道我是否可以从这个文件中在 android 上的 map 上画一条线在代码中放置点对点。

Yes, a LineString can be drawn with a Mapbox Maps SDK LineLayer .是的,可以使用 Mapbox Maps SDK LineLayer绘制LineString

https://github.com/mapbox/mapbox-android-demo/search?q=LineLayer&unscoped_q=LineLayer https://github.com/mapbox/mapbox-android-demo/search?q=LineLayer&unscoped_q=LineLayer

You might find these Mapbox demo app examples especially helpful and inspirational:您可能会发现这些 Mapbox 演示应用示例特别有用和鼓舞人心:

The Annotation Plugin is another option for drawing lines https://docs.mapbox.com/android/plugins/overview/annotation/ .注释插件是绘制线条https://docs.mapbox.com/android/plugins/overview/annotation/的另一个选项。 You can use a local file with the Plugin, as seen at https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java#L89您可以将本地文件与插件一起使用,如https://github.com/mapbox/mapbox-plugins-android/blob/master/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp所示/activity/annotation/LineActivity.java#L89

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

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