mapbox / mapbox/mapbox-java

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

Ouverte
#1,635 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Java
Étoiles
438
Forks
117
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Comparez les implémentations existantes de turf-bezier-spline dans Turf.js et Turf for Swift, puis examinez le point d’entrée TurfMisc du Java SDK. Implémentez l’API TurfMisc.bezier manquante pour les entrées LineString et vérifiez que sa sortie courbe correspond au comportement de Web et d’iOS.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
android, java
Domaine
mobile-dev
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.