mapbox / mapbox/mapbox-java

Feature Request: Port `turf-bezier-spline` to Mapbox Java (Android)

Abierto
#1,635 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Java
Estrellas
438
Forks
117
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Description

Currently, the Mapbox Java SDK's Turf implementation lacks the turf-bezier-spline module. This feature is readily available in both Turf.js (Web) and Turf for Swift (iOS), but Android developers are left without a native way to generate smooth Bézier curves from a LineString.

When building cross-platform applications that rely on consistent map rendering, the absence of TurfMisc.bezier() in Java forces Android developers to write custom mathematical utilities to calculate intermediate curve coordinates, rather than relying on the official Turf ecosystem.

Expected Behavior

Port the turf-bezier-spline algorithm to mapbox-java so that Android developers can pass a straight LineString with control points and receive a curved LineString or Feature in return, matching the behavior of the Web and iOS SDKs.

Example of Desired API usage (Java)
List<Point> points = Arrays.asList(
    Point.fromLngLat(-122.414, 37.776),
    Point.fromLngLat(-122.420, 37.780), // Control point
    Point.fromLngLat(-122.425, 37.776)
);
LineString straightLine = LineString.fromLngLats(points);

// This is currently missing:
Feature curvedFeature = TurfMisc.bezier(straightLine);
Current Workaround

Manually calculating the Quadratic/Cubic Bézier mathematical formulas in a custom Java utility class, generating a dense list of Point objects, and then passing those to a standard LineString. This is inefficient and prone to projection errors compared to a dedicated Turf module.

Context

This missing feature was also noted internally by the Mapbox team in the navigation-android SDK (Issue #3018) back in 2020. Adding this would greatly improve feature parity between Mapbox's Web, iOS, and Android ecosystems.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Compara las implementaciones existentes de turf-bezier-spline en Turf.js y Turf for Swift; después, inspecciona el punto de entrada TurfMisc del Java SDK. Implementa la API TurfMisc.bezier que falta para entradas de LineString y verifica que su salida curva coincida con el comportamiento de Web e iOS.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, java
Área
mobile-dev
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.