-
Notifications
You must be signed in to change notification settings - Fork 153
Open
Description
Description
Currently, the Mapbox Maps SDK for Android does not provide a built-in way to render a direction cone (also known as a sector, view cone, or field-of-view arc).
Developers must manually compute latitude/longitude points along an arc and create a polygon to visualize a directional area — for example, a Qibla direction cone or camera field of view.
This requires repetitive math and custom logic:
- Computing arc coordinates using spherical trigonometry
- Handling wrap-around at 0°/360° and anti-meridian crossings
- Creating polygons manually with
PolygonAnnotationorFillLayer
Example use case
Visualizing directional areas such as:
- Camera or compass “view cones”
- Radar or sensor field of view
- Qibla direction cone from a user’s location
Suggested solution
Add a lightweight helper API to easily draw a directional cone centered on a Point, given:
center: geographic point (latitude, longitude)bearing: direction in degreeshalfAngle: cone spread in degreesradius: distance in meters or kilometersfillColor/fillOpacity: optional styling
Example usage
mapView.annotations.createDirectionCone(
center = Point.fromLngLat(lon, lat),
bearing = heading,
halfAngle = 25.0,
radius = 300000.0, // meters
fillColor = Color.parseColor("#6600EEFF"),
fillOpacity = 0.35
)Expected behavior:
- SDK internally computes and renders the cone polygon
- Automatically handles projection and anti-meridian issues
- Provides consistent results across zoom levels and map projections
Why
Drawing a simple fan-shaped area currently requires non-trivial math and boilerplate, which developers have to reimplement in every project.
A built-in API would:
- Simplify rendering of directional indicators
- Reduce code duplication across apps
- Improve maintainability and readability
- Enable new UX patterns (e.g., navigation view cones, AR guidance, Qibla direction indicators)
Metadata
Metadata
Assignees
Labels
No labels