use of com.mapbox.services.commons.models.Position in project androidApp by InspectorIncognito.
the class MapboxUtil method convertToLatLng.
public static LatLng convertToLatLng(Feature feature) {
Point symbolPoint = (Point) feature.getGeometry();
Position position = symbolPoint.getCoordinates();
return new LatLng(position.getLatitude(), position.getLongitude());
}
use of com.mapbox.services.commons.models.Position in project mapbox-navigation-android by mapbox.
the class NavigationMapRoute method findPointOnLine.
private com.mapbox.geojson.Point findPointOnLine(com.mapbox.geojson.Point clickPoint, LineString lineString) {
List<com.mapbox.geojson.Point> linePoints = new ArrayList<>();
List<Position> positions = lineString.getCoordinates();
for (Position pos : positions) {
linePoints.add(com.mapbox.geojson.Point.fromLngLat(pos.getLongitude(), pos.getLatitude()));
}
com.mapbox.geojson.Feature feature = TurfMisc.nearestPointOnLine(clickPoint, linePoints);
return (com.mapbox.geojson.Point) feature.geometry();
}
Aggregations