Skip to content

Add a helper to draw curved arcs between ordered map points #586

@jamiefolsom

Description

@jamiefolsom

Overview

For the Ritual Map Paths feature (performant-software/core-data-places#658) we need to draw curved arc lines connecting a path's ordered stops (stop 1 → stop 2 → stop 3 …), shown as dashed arcs on the map. This is a small, reusable piece of map geometry, so it belongs in the shared geospatial library, next to the existing uncertainty-circle helper.

Specifics

  • Given an ordered list of points, produce curved arc geometry connecting each consecutive pair.
  • Each arc can be identified by its position in the sequence, so a consumer can style or highlight one segment.
  • The amount of curve is adjustable. At the scale of these maps (stops a few hundred meters apart) a true great-circle arc looks straight — the curvature only shows over long distances — so a visible bow means a deliberate, adjustable curve.
  • No new runtime dependency: turf.js (7.x) is already a dependency and is what the existing circle helper uses; it also bundles @turf/bezier-spline, @turf/great-circle, and @turf/along.

A suggested shape

This is just one way to do it; if you see a cleaner approach, please use it.

  • A function alongside Map.toCertaintyCircle, for example Map.toArcs(coordinates, { curvature }), returning a GeoJSON FeatureCollection of LineStrings — one arc per consecutive pair, each tagged with its position in the sequence.
  • To make the bow: for each pair A→B, take the midpoint, push it sideways by curvature × distance(A, B), then run [A, midpoint, B] through @turf/bezier-spline. curvature defaults to a small value (around 0.2) and is adjustable.

Relevant code

  • @performant-software/geospatialMap.toCertaintyCircle(point, radiusKm) is the pattern to mirror (a point + radius → a GeoJSON circle via @turf/circle).
  • core-data-places/src/apps/detailPages/PlaceMap.tsx — shows how the app draws that circle as a map layer.

Shipping

Part of performant-software/core-data-places#658.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions