{
"type":"FeatureCollection",
"generator":"JOSM",
"features":[
{
"type":"Feature",
"properties":{
},
"geometry":{
"type":"LineString",
"coordinates":[
[
121.54821846780,
24.98741107673
],
[
121.54812039953,
24.98739360280
],
[
121.54812750162,
24.98736155308
],
[
121.54813477853,
24.98732871440
],
[
121.54814403650,
24.98728693577
]
]
}
},
{
"type":"Feature",
"properties":{
},
"geometry":{
"type":"LineString",
"coordinates":[
[
121.54813477853,
24.98732871440
],
[
121.54819734540,
24.98733966151
],
[
121.54819365737,
24.98735561598
]
]
}
},
{
"type":"Feature",
"properties":{
},
"geometry":{
"type":"LineString",
"coordinates":[
[
121.54812750162,
24.98736155308
],
[
121.54780189872,
24.98730374867
],
[
121.54776282754,
24.98729681235
]
]
}
}
]
this is Geojson path,how could I draw two point,and the route will follow this path? I used JOSM to draw.
if (route == true) {
start = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(point.getLatitude(), point.getLongitude())).title("start").icon(icon));
route = false;
} else {
if(destination!=null){
mapboxMap.removeMarker(destination);
}
destination = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(point.getLatitude(), point.getLongitude())).title("finish"));
LatLng[] points = new LatLng[2];
LatLng loc = new LatLng(start.getPosition());
LatLng dest = new LatLng(destination.getPosition());
points[0] = loc;
points[1] = dest;
if (poly != null) {
mapboxMap.removePolyline(poly);
}
poly = mapboxMap.addPolyline(new PolylineOptions()
.add(points)
.color(Color.parseColor("#3887be"))
.width(5));
}
the route is straight line,I want route draw on my Geojson path,how can i do? I want the two marker follow my path to plan the best path,I can load the Geojson path on Android and draw the path on map,but how do i let the two point follow my path to creat the route? thanks!